[llvm] InstCombine: Stop transforming EQ/NE of SHR to 0 to ULT/UGT if >1 use (PR #168007)

Danila Malyutin via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 09:05:28 PST 2025


danilaml wrote:

I've noticed that this might regress in the rare case where both IR patters are produces (shift and cmp imm). Previously, as everything was "canonicalized" to a single representation, it got CSEd, but now it's possible to end up in a situation where there is a cmp against shr result followed by a cmp against constant. Can be possible to achieve with some inlining (although I'm struggling to come up with a small reproducer).

I'd expect CorrelatedValuePropagation pass to solve this, but it seems like it can't figure out that `(lshr %0, 8) == 0` implies `%0 < 256`.

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


More information about the llvm-commits mailing list