Skip to content
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

Re-enable the early otherwise branch optimization #122387

Merged
merged 5 commits into from Apr 9, 2024

Conversation

DianQK
Copy link
Member

@DianQK DianQK commented Mar 12, 2024

Closes #95162. Fixes #119014.

This is the first part of #121397.

An invalid enum discriminant can come from anywhere. We have to check to see if all successors contain the discriminant statement. This should have a pass to hoist instructions.

r? cjgillot

@rustbot
Copy link
Collaborator

rustbot commented Mar 12, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 12, 2024
@bors
Copy link
Contributor

bors commented Mar 13, 2024

☔ The latest upstream changes (presumably #122423) made this pull request unmergeable. Please resolve the merge conflicts.

@DianQK DianQK force-pushed the re-enable-early-otherwise-branch branch from d16bb62 to 57d566e Compare March 13, 2024 14:47
@DianQK
Copy link
Member Author

DianQK commented Mar 27, 2024

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 27, 2024
@bors
Copy link
Contributor

bors commented Mar 27, 2024

⌛ Trying commit 57d566e with merge 1c207eb...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 27, 2024
…nch, r=<try>

Re-enable the early otherwise branch optimization

Closes rust-lang#95162. Fixes rust-lang#119014.

This is the first part of rust-lang#121397.

An invalid enum discriminant can come from anywhere. We have to check to see if all successors contain the discriminant statement. This should have a pass to hoist instructions.

r? cjgillot
@bors
Copy link
Contributor

bors commented Mar 27, 2024

☀️ Try build successful - checks-actions
Build commit: 1c207eb (1c207eb7b67fd11382d4e3cb46c8391d16a27f4d)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1c207eb): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.6%, -0.3%] 4
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.8% [-4.9%, -0.8%] 13
Improvements ✅
(secondary)
-3.2% [-4.8%, -2.0%] 37
All ❌✅ (primary) -1.8% [-4.9%, -0.8%] 13

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% [-1.0%, -0.8%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.9% [-1.0%, -0.8%] 4

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 670.407s -> 669.691s (-0.11%)
Artifact size: 315.71 MiB -> 315.69 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 27, 2024
@cjgillot
Copy link
Contributor

cjgillot commented Apr 7, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Apr 7, 2024

📌 Commit 57d566e has been approved by cjgillot

It is now in the queue for this repository.

@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 Apr 7, 2024
@DianQK
Copy link
Member Author

DianQK commented Apr 7, 2024

Oops, I need to update the pass name to UnreachableEnumBranching after #122225.

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 7, 2024
@DianQK DianQK force-pushed the re-enable-early-otherwise-branch branch from 57d566e to 6196373 Compare April 7, 2024 13:09
@DianQK DianQK force-pushed the re-enable-early-otherwise-branch branch from 6196373 to 5428a15 Compare April 7, 2024 13:17
@DianQK
Copy link
Member Author

DianQK commented Apr 7, 2024

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 7, 2024
@cjgillot
Copy link
Contributor

cjgillot commented Apr 7, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Apr 7, 2024

📌 Commit 5428a15 has been approved by cjgillot

It is now in the queue for this repository.

@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 Apr 7, 2024
@bors
Copy link
Contributor

bors commented Apr 7, 2024

⌛ Testing commit 5428a15 with merge 7427e2c...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 7, 2024
…nch, r=cjgillot

Re-enable the early otherwise branch optimization

Closes rust-lang#95162. Fixes rust-lang#119014.

This is the first part of rust-lang#121397.

An invalid enum discriminant can come from anywhere. We have to check to see if all successors contain the discriminant statement. This should have a pass to hoist instructions.

r? cjgillot
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Apr 7, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 7, 2024
@DianQK DianQK force-pushed the re-enable-early-otherwise-branch branch from 5428a15 to 166bb1b Compare April 8, 2024 11:21
@DianQK
Copy link
Member Author

DianQK commented Apr 8, 2024

LLVM 17 cannot optimize it: https://godbolt.org/z/8d9PEoh9G. I have added @ min-llvm-version: 18.

@WaffleLapkin
Copy link
Member

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Apr 8, 2024

📌 Commit 166bb1b has been approved by cjgillot

It is now in the queue for this repository.

@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 Apr 8, 2024
@bors
Copy link
Contributor

bors commented Apr 9, 2024

⌛ Testing commit 166bb1b with merge 59c808f...

@bors
Copy link
Contributor

bors commented Apr 9, 2024

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 59c808f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 9, 2024
@bors bors merged commit 59c808f into rust-lang:master Apr 9, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 9, 2024
@DianQK DianQK deleted the re-enable-early-otherwise-branch branch April 9, 2024 03:04
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (59c808f): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.7% [-0.7%, -0.7%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.6% [2.6%, 2.6%] 1
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.6% [2.6%, 2.6%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 674.046s -> 674.144s (0.01%)
Artifact size: 318.46 MiB -> 318.36 MiB (-0.03%)

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
7 participants