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

Rename UninhabitedEnumBranching to UnreachableEnumBranching #122225

Merged
merged 6 commits into from
Apr 3, 2024

Conversation

DianQK
Copy link
Member

@DianQK DianQK commented Mar 9, 2024

Per #120268, I rename UninhabitedEnumBranching to UnreachableEnumBranching .

I solved some nits to add some comments.

I adjusted the workaround restrictions. This should be useful for a <= b and if let Some/Ok(v). For enum with few variants, early-tailduplication should not cause compile time overhead.

r? RalfJung

@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 9, 2024
@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@RalfJung
Copy link
Member

RalfJung commented Mar 9, 2024

Thanks for the PR! However, unfortunately I can't review any behavior change in a MIR opt, nor can I tell whether the new tests make sense.
r? compiler

@rustbot rustbot assigned compiler-errors and unassigned RalfJung Mar 9, 2024
@cjgillot
Copy link
Contributor

cjgillot commented Mar 9, 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 9, 2024
@bors
Copy link
Contributor

bors commented Mar 9, 2024

⌛ Trying commit 2b156ba with merge ba9e2ee...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 9, 2024
 Rename `UninhabitedEnumBranching` to `UnreachableEnumBranching`

Per [rust-lang#120268](rust-lang#120268 (comment)), I rename `UninhabitedEnumBranching` to `UnreachableEnumBranching` .

I solved some nits to add some comments.

I adjusted the workaround restrictions. This should be useful for `a <= b` and `if let Some/Ok(v)`. For enum with few variants, `early-tailduplication` should not cause compile time overhead.

r? RalfJung
@bors
Copy link
Contributor

bors commented Mar 9, 2024

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ba9e2ee): comparison URL.

Overall result: ❌ regressions - 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.3% [0.3%, 0.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
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.5% [0.2%, 3.8%] 5
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-9.6% [-12.0%, -7.2%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.9% [-12.0%, 3.8%] 7

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.9% [0.9%, 0.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.9% [0.9%, 0.9%] 1

Binary size

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.1% [0.1%, 0.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.1%, -0.0%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.1%, 0.1%] 5

Bootstrap: 650.585s -> 649.35s (-0.19%)
Artifact size: 310.34 MiB -> 310.38 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 9, 2024
@cjgillot cjgillot self-assigned this Mar 10, 2024
@DianQK
Copy link
Member Author

DianQK commented Mar 11, 2024

@cjgillot Would you be willing to add yourself to mir-opt in triagebot.toml. Then I can use r? mir-opt. :)

let replace_otherwise_to_unreachable = otherwise_is_last_variant
|| !otherwise_is_empty_unreachable && allowed_variants.is_empty();
|| (!otherwise_is_empty_unreachable && allowed_variants.is_empty());

if unreachable_targets.is_empty() && !replace_otherwise_to_unreachable {
continue;
Copy link

@riking riking Mar 12, 2024

Choose a reason for hiding this comment

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

The allow(rustc::potential_query_instability) should include a comment that the length of the list is known to be 1. Or use one of the exactly_one iterator adapaters.

@compiler-errors compiler-errors removed their assignment Mar 12, 2024
@cjgillot
Copy link
Contributor

cjgillot commented Apr 3, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Apr 3, 2024

📌 Commit ec313d1 has been approved by cjgillot

It is now in the queue for this repository.

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 3, 2024
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Apr 3, 2024
@bors
Copy link
Contributor

bors commented Apr 3, 2024

⌛ Testing commit ec313d1 with merge 76cf07d...

@bors
Copy link
Contributor

bors commented Apr 3, 2024

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 76cf07d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 3, 2024
@bors bors merged commit 76cf07d into rust-lang:master Apr 3, 2024
12 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 3, 2024
@DianQK DianQK deleted the nits-120268 branch April 3, 2024 08:31
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (76cf07d): 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.3% [-0.3%, -0.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-0.3%, -0.3%] 1

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)
6.0% [4.8%, 7.0%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.0% [-3.8%, -0.2%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.8% [-3.8%, 7.0%] 5

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)
2.1% [2.1%, 2.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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.2% [0.0%, 0.3%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.1% [-0.3%, -0.0%] 9
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.3%, 0.3%] 12

Bootstrap: 667.614s -> 668.678s (0.16%)
Artifact size: 318.09 MiB -> 318.11 MiB (0.00%)

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
Development

Successfully merging this pull request may close these issues.

8 participants