[llvm] [InstCombine] Fix #163110: Fold icmp (shl X, L), (add (shl Y, L), 1<<L) to icmp X, (Y + 1) (PR #165975)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 09:01:54 PST 2026


================

----------------
nikic wrote:

I'm a bit confused by this comment. Why are left and right shifts treated differently here? A left shift can also lose information.

My understanding of these functions is that they are cost modelling functions (i.e. "is it cheap to push the shift into this expression?") and not statements about the behavior of the shift (i.e. "if I shift this value and then shift back, do I get the same value?")

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


More information about the llvm-commits mailing list