-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve value numbering for casts #59841
Conversation
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsNow that we no longer fold overflowing conversions with implementation-defined behavior, it is possible to unify how the cast helpers are value numbered and how regular casts are numbered. There are also changes that enable global constant propagation into calls, this was necessary to fix some of the regressions that showed up. The remaining regressions are due to #57033 (we propagate "just above" the helper and see it as a side effect). Diffs: pending.
|
b2d50ef
to
fc2cc3d
Compare
Remove duplication between VNPairForCast and VNForCast, route the former through the latter. Also change the debug output for casts. No diffs for this commit.
VN cast helpers just like casts. This allows them to be folded. In the past, this was dangerous because some of the pessimization protected us from undefined behavior in cases of out-of-bounds conversions, but now we do not fold such cases anymore.
This solves some of the regressions seen due to now-missing CSEs of these helper calls evaluated as constants by VN.
This fixes the test failures revealed by the more aggressive constant propagation. This is very similar to a bug that was recently fixed where checked casts were treated as non-checked and could be observed without the assertion propagation changes as well, with the redundant branches optimization.
239e961
to
3bcf1a9
Compare
@dotnet/jit-contrib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Now that we no longer fold overflowing conversions with implementation-defined behavior, it is possible to unify how the cast helpers are value numbered and how regular casts are numbered.
There are also changes that enable global constant propagation into calls, this was necessary to fix some of the regressions that showed up. The remaining regressions are due to #57033 (we propagate "just above" the helper and see it as a side effect).
Diffs:
win-x64
,win-x86
,linux-arm