Closed
Description
Description
Given the following code, only the first function optimizes acceptably here. I'm not quite sure why it can't kick in for the other cases?
Reproduction Steps
public class C {
[SharpLab.Runtime.JitGeneric(typeof(int))]
public bool GetValueOrNull<T>()
{
if (default(T) != null)
return true;
return false;
}
[SharpLab.Runtime.JitGeneric(typeof(int))]
public bool GetValueOrNullSlow<T>()
{
if (default(T) != null)
return false;
return false;
}
[SharpLab.Runtime.JitGeneric(typeof(int))]
public void GetValueOrNullSlow2<T>()
{
if (default(T) != null)
return;
return;
}
}
Expected behavior
GetValueOrNullSlow and GetValueOrNullSlow2 are both optimized like GetValueOrNull
Actual behavior
They don't
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response