-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Codegen regression involving assume/unreachable_unchecked #110551
Copy link
Copy link
Closed
Labels
A-mir-opt-inliningArea: MIR inliningArea: MIR inliningC-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Metadata
Metadata
Assignees
Labels
A-mir-opt-inliningArea: MIR inliningArea: MIR inliningC-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
I tried this code:
I expected to see this happen: no branch instructions emitted,
unreachable_uncheckedmakes an assumption thataisNone, sounwrapshould be inlined and optimized as a panic.Instead, this happened: there is a discriminant check still emitted.
Version it worked on
It most recently worked on: nightly-2023-03-26
Version with regression
ASM diff
See godbolt: https://godbolt.org/z/5WKTY99Te
Bisection results
Regression occurred in #106428 (cc @saethlin).
searched nightlies: from nightly-2023-03-01 to nightly-2023-04-01
regressed nightly: nightly-2023-03-27
searched commit range: 0c61c7a...db0cbc4
regressed commit: 2420bd3
bisected with cargo-bisect-rustc v0.6.6
Host triple: aarch64-unknown-linux-gnu
Reproduce with:
t.sh
(if you want to test on
x86_64replace"cbz\s+w0, .LBB0_2"with"testl\s+%edi, %edi")t.rs
History
@heckad originally noticed the problem and opened #110456, then @WaffleLapkin suggested that this is a compiler issue, then @bugadani noticed that this is a regression, then @WaffleLapkin bisected and opened this issue.