-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
JIT: experimental changes to redundant branch opts #88527
Conversation
Recognize a particular case where a control flow pattern involving two BBJ_COND blocks with relops that test the same VNs can be simplified to a single relop in the dominating block. As part of this, teach VN about some of the rudiments of boolean simplification (DeMorgan's laws) and how to simplify some NOT / AND / OR expressions involving relops. Addresses some of the cases in dotnet#81220.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsRecognize a particular case where a control flow pattern involving two BBJ_COND blocks with relops that test the same VNs can be simplified to a single relop in the dominating block. As part of this, teach VN about some of the rudiments of boolean simplification (DeMorgan's laws) and how to simplify some NOT / AND / OR expressions involving relops. Addresses some of the cases in #81220. [This is an updated version of #83859]
|
Will this also fix #88025 (comment)? |
Failure looks similar to #88579 (timeout in remote executor) |
No, it doesn't fix that case (though it does a ton of flow graph simplification). Seems like for that we could try running a late tail merge...? That should be fairly cheap, let me see what happens. |
Well, not quite that simple, we are left with this sort of thing after running opts and fg cleanup:
As you can see this should all collapse to returning zero, but tail merging is hindered by the no-longer relevant PHI and the fact that the zero in BB22 needs to propagate through a few intermediate assignments. You might wonder why we didn't realize that A more heavy-weight optimizer might rebuild SSA/VN after RBO, or run multiple passes of optimization, but that's not something we would do lightly... |
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
Recognize a particular case where a control flow pattern involving two BBJ_COND blocks with relops that test the same VNs can be simplified to a single relop in the dominating block.
As part of this, teach VN about some of the rudiments of boolean simplification (DeMorgan's laws) and how to simplify some NOT / AND / OR expressions involving relops.
Addresses some of the cases in #81220.
[This is an updated version of #83859]