Open theemathas opened 2 days ago
As far as I can see, something very similar is at least partially fixed on LLVM trunk: https://godbolt.org/z/MzqG7rf9d. There's also another similar issue: https://github.com/llvm/llvm-project/issues/117853, but I'm not sure if it's relevant to this particular issue.
@rustbot label +A-LLVM
Looks like all 3 functions optimize to the same thing on LLVM trunk opt
I tried this code, which contains 3 functions which check if all the bits in a u64 are all ones:
I expected to see this happen:
ne_bytes()
should be optimized to the same thing asdirect()
, whileblack_box_ne_bytes()
should be optimized slightly worseInstead, this happened: I got the following assembly, where
ne_bytes()
is somehow optimized worse thanblack_box_ne_bytes()
Godbolt
Meta
Reproducible on godbolt with stable
rustc 1.82.0 (f6e511eec 2024-10-15)
and nightlyrustc 1.85.0-nightly (7db7489f9 2024-11-25)