-
Notifications
You must be signed in to change notification settings - Fork 13.3k
MIR peephole optimize {Ne, Eq}(_1, false) into _1 #76067
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
Conversation
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
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.
I don't know much about peephole optimization but looks good to me.
Would this affect compile time? Should we run a timer? |
My intuition says that this shouldn't be that expensive but let's try perf bot to be sure? |
@jyn514 Can you please help to run perf bot? |
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, r=me after perf
@bors try @rust-timer queue |
Awaiting bors try build completion |
@davidtwco: 🔑 Insufficient privileges: not in try users |
@bors try |
⌛ Trying commit 320929a2d83ac8a960254eb89380e08dd5f58c55 with merge 13cacc3bbd9269bca180ad9e3a9d2bed057b60d1... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 13cacc3bbd9269bca180ad9e3a9d2bed057b60d1 with parent b1d092c, future comparison URL. |
Finished benchmarking try commit (13cacc3bbd9269bca180ad9e3a9d2bed057b60d1): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
320929a
to
f23e915
Compare
@davidtwco rebased on master to fix merge conflicts. It should be ready for a new bors try |
I'm not sure what conclusions can be drawn from the perf results - going to let someone else take a look before merging. r? @wesleywiser
I don't think we'll need another perf run, so another try build isn't necessary. |
This looks good to me but I think for consistency we should do the same thing for |
I can extend the PR to also handle the Eq case today, sure. |
@wesleywiser added a new commit so that Eq is handled similarly |
We usually do not rollup MIR optimizations even if they don't seem to have a performance impact because it would be best for bisection purposes if this does not end up in a rollup. Therefore @bors r+ rollup=never |
📌 Commit 14cd6da2fdcf38d7c226ea8bfaf530357153e0e1 has been approved by |
@wesleywiser Do we usually not run timer for this? |
@pickfire I think since just the |
⌛ Testing commit 14cd6da2fdcf38d7c226ea8bfaf530357153e0e1 with merge e87c8a880736e304322e8d5be6b51ee33a2dd162... |
💔 Test failed - checks-actions |
… _1) into _1 This was observed emitted from the MatchBranchSimplification pass.
14cd6da
to
9b0fc62
Compare
So I don't know why exactly the test failed:
I rebased on master locally, rebless and that did change my test. So i have now force pushed that. @wesleywiser can you start the bors dance again? |
@bors r=wesleywiser |
📌 Commit 9b0fc62 has been approved by |
☀️ Test successful - checks-actions, checks-azure |
Add peephole optimization that simplifies Ne(_1, false) and Ne(false, _1) into _1. Similarly handles Eq(_1, true) and Eq(true, _1).
This was observed emitted from the MatchBranchSimplification pass.