Fix for a bug in fgMorphRecognizeBoxNullable.
fgMorphRecognizeBoxNullable doesn't work correctly when called during re-morphing. In particular it can't handle late args in the call to CORINFO_HELP_BOX_NULLABLE. The test case results in several asserts (the first one in lsra) followed by an infinite loop in the jit.
The reason the optimization is not performed during global morph is that only patterns with GT_EQ and GT_NE are handled. Some versions of csc generate
...
ldnull
cgt.un
ret
for
this C# line
null != this.value
so we get GT_GT instead.
The fix has two parts:
1. Don't attempt to perform the optimization when called during re-morph and the struct parameter is a late arg.
2. Call fgMorphRecognizeBoxNullable for GT_GT nodes with GTF_UNSIGNED set. This allows the optimization to fire during global morph.
Commit migrated from https://github.com/dotnet/coreclr/commit/
e78d2fd7a533c5244e442fdaec032ca697fc8a97