-
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
LLVM doesn't understand Some(Box<u32>) is always some #36010
Comments
Probably using The fundamental problem is that it's hard to decide when to apply metadata because of how completely arbitrary and unreasonably difficult our ADT handling is (i.e. That said, we already keep that information so it could be used... oh, huh, we already apply |
Same for |
I was wondering why this optimizes for me locally, but not on playground ... turns out it optimizes properly at O2, but not at O3 :( |
The cause is argument promotion. A pointer argument is promoted to a scalar, and looses the |
Since rustc 1.45 the following IR is emitted at
|
rustc 1.65 has already fixed this issue: https://rust.godbolt.org/z/8cz6rn3v1. @rustbot label E-needs-test -llvm-fixed-upstream (I used the wrong label.) |
@rustbot label -llvm-fixed-upstream |
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
playground
For the following code:
This compiles down to the IR (optimized)
It seems odd that the
Box
case is not as optimized as theu32
case? This seems due to the null-pointer optimization of theOption<Box>
itself. I wonder if there's more metadata we can attach to tell LLVM the loads aren't null?The text was updated successfully, but these errors were encountered: