[llvm] [Instcombine] Fold away shift in or reduction chain. (PR #137875)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu May 1 09:30:53 PDT 2025


https://github.com/dtcxzyw commented:

I am fine with this fold itself. But it prevents AggressiveInstCombine from merging consecutive loads: https://godbolt.org/z/aq94MeM3n

We should not perform this fold when the shift's LHS is `zext(load)`.
If you think this workaround is too fragile, an alternative solution is to convert `(load iN p) | (load iN p+N/8) == 0` into `(load i2N p) == 0` in AggressiveInstCombine.


https://github.com/llvm/llvm-project/pull/137875


More information about the llvm-commits mailing list