Skip to content

Peephole optimize x == false and x != true #86107

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

Merged
merged 1 commit into from
Jun 9, 2021

Conversation

syvb
Copy link
Contributor

@syvb syvb commented Jun 7, 2021

This adds peephole optimizations to make x == false, false == x, x != true, and true != x get optimized to !x in the instcombine MIR pass. That pass currently handles x == true -> x already.

@rust-highfive
Copy link
Contributor

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 7, 2021
@wesleywiser
Copy link
Member

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 7, 2021
@bors
Copy link
Collaborator

bors commented Jun 7, 2021

⌛ Trying commit 2f1c219 with merge e2c32a71d8e2919c91fcde05b55ff8c486a9cdc2...

@petrochenkov
Copy link
Contributor

r? @wesleywiser

@bors
Copy link
Collaborator

bors commented Jun 7, 2021

☀️ Try build successful - checks-actions
Build commit: e2c32a71d8e2919c91fcde05b55ff8c486a9cdc2 (e2c32a71d8e2919c91fcde05b55ff8c486a9cdc2)

@rust-timer
Copy link
Collaborator

Queued e2c32a71d8e2919c91fcde05b55ff8c486a9cdc2 with parent e4a6032, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (e2c32a71d8e2919c91fcde05b55ff8c486a9cdc2): 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 rollup- to bors.

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
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 7, 2021
Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@wesleywiser
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 8, 2021

📌 Commit 2f1c219 has been approved by wesleywiser

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 8, 2021
@bors
Copy link
Collaborator

bors commented Jun 9, 2021

⌛ Testing commit 2f1c219 with merge d45d205...

@bors
Copy link
Collaborator

bors commented Jun 9, 2021

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing d45d205 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 9, 2021
@bors bors merged commit d45d205 into rust-lang:master Jun 9, 2021
@rustbot rustbot added this to the 1.54.0 milestone Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants