Open Altanis opened 3 weeks ago
This is https://github.com/llvm/llvm-project/issues/58996, and needs to be fixed in LLVM. Rust itself won't do this optimization.
@scottmcm @DianQK @nikic This issue has been fixed by https://github.com/llvm/llvm-project/pull/107745. Please add llvm-fixed-upstream
.
You can also add it. :) @rustbot label +llvm-fixed-upstream
@dtcxzyw Doesn't this issue need support for dominating condition rather than assumption?
@dtcxzyw Doesn't this issue need support for dominating condition rather than assumption?
I am preparing a follow-up patch for this :)
@rustbot label -llvm-fixed-upstream
I tried this code:
Since
assert!(buckets.is_power_of_two())
is run (and.is_power_of_two()
is an inbuilt function), the latter modulus operation should reduce tokey & (buckets - 1)
.Instead, the outputted assembly here shows that this reduction does not take place.
Meta
The compiler in the GodBolt link is version 1.80.0.