-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged