-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Compiler fails to remove jumps using jump table if every label in it is same #110797
Comments
This seems a regression introduced in Rust 1.65: https://godbolt.org/z/7vnT1z67E @rustbot label +regression-from-stable-to-stable |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium +T-compiler +I-slow |
It's another typed GEP issue. |
Fixed in 1.73, presumably due to the LLVM 17 upgrade (#114048): https://godbolt.org/z/WTcKvcfh4 This specific example seems to be a backend optimization (the optimized IR is the same in 1.72 and 1.73); the general case is fixed in nightly by #121665: https://godbolt.org/z/cxnsWoWzx. @rustbot label +E-needs-test |
Add codegen tests for E-needs-test close rust-lang#36010 close rust-lang#68667 close rust-lang#74938 close rust-lang#83585 close rust-lang#93036 close rust-lang#109328 close rust-lang#110797 close rust-lang#111508 close rust-lang#112509 close rust-lang#113757 close rust-lang#120440 close rust-lang#118392 close rust-lang#71096 r? nikic
Add codegen tests for E-needs-test close rust-lang#36010 close rust-lang#68667 close rust-lang#74938 close rust-lang#83585 close rust-lang#93036 close rust-lang#109328 close rust-lang#110797 close rust-lang#111508 close rust-lang#112509 close rust-lang#113757 close rust-lang#120440 close rust-lang#118392 close rust-lang#71096 r? nikic
Add codegen tests for E-needs-test close rust-lang#36010 close rust-lang#68667 close rust-lang#74938 close rust-lang#83585 close rust-lang#93036 close rust-lang#109328 close rust-lang#110797 close rust-lang#111508 close rust-lang#112509 close rust-lang#113757 close rust-lang#120440 close rust-lang#118392 close rust-lang#71096 r? nikic
Add codegen tests for E-needs-test close rust-lang#36010 close rust-lang#68667 close rust-lang#74938 close rust-lang#83585 close rust-lang#93036 close rust-lang#109328 close rust-lang#110797 close rust-lang#111508 close rust-lang#112509 close rust-lang#113757 close rust-lang#120440 close rust-lang#118392 close rust-lang#71096 r? nikic
I tried this code:
I expected to see this happen:
Since layout of each enum variant is same, I expected to get machine code without any jumps, e.g.
Instead, this happened:
Compiler generates jump table, every branch of it points to the same code, and code jumps using it despite being it redundant.
Meta
rustc --version --verbose
:Also, godbolt link.
The text was updated successfully, but these errors were encountered: