[llvm] [InstCombine] Add more cases for simplifying `(icmp (and/or x, Mask), y)` (PR #85138)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 09:52:36 PDT 2024


================
@@ -4177,7 +4177,9 @@ static bool isMaskOrZero(const Value *V, bool Not, const SimplifyQuery &Q,
 /// a check for a lossy truncation.
 /// Folds:
 ///   icmp SrcPred (x & Mask), x    to    icmp DstPred x, Mask
+///   icmp SrcPred (x & ~Mask), ~Mask    to    icmp DstPred x, ~Mask
 ///   icmp eq/ne (x & ~Mask), 0     to    icmp DstPred x, Mask
+///   icmp eq/ne (x | ~Mask), -1     to    icmp DstPred x, Mask
----------------
nikic wrote:

Is this supposed to be?
```suggestion
///   icmp eq/ne (~x | Mask), -1     to    icmp DstPred x, Mask
```

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


More information about the llvm-commits mailing list