Repository navigation
Give a proper VN to GT_BOX - #15666
Conversation
GT_BOX doesn't do anything so it should just get the VN of its sole operand. This allows assertion prop to see that the result of BOX is not null (since the BOX operand is the result of an object allocation which is never null).
|
jit-diff summary: |
|
A complete (mostly, unfortunately different generic instantiations are reported as one method) list of affected methods is interesting to see where a certain pattern occurs - boxing followed by a null/type check:
|
It looks like coreclr/src/mscorlib/shared/System/ValueTuple.cs Lines 2259 to 2268 in 64ea348 Hrm, this |
AndyAyersMS
left a comment
There was a problem hiding this comment.
Thanks for spotting this. Looks good.
|
@AndyAyersMS @mikedn Looks like this caused an assert in armlb testing: https://ci.dot.net/job/dotnet_coreclr/job/master/job/armlb_cross_checked_windows_nt_flow/365/ |
|
Hmm, armlb is the legacy backend, right? |
|
Correct. |
|
Saw something similar over on desktop with the x86 frankenjit: |
|
Thanks, I've reproduced locally with legacynonjit.dll and the following code: Dictionary<string, bool?> d = new Dictionary<string, bool?>();
d.Add("foo", true);
return d["foo"];I'll investigate more this evening (your morning-afternoon). Heading out to work... |
GT_BOXdoesn't do anything so it should just get the VN of its sole operand. This allows assertion prop to see that the result ofBOXis not null (since theBOXoperand is the result of an object allocation which is never null).