[llvm] [InstCombine] Improve folding of `icmp pred (and X, Mask/~Mask), Y)` (PR #81562)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 09:27:27 PST 2024


================
@@ -4163,7 +4293,9 @@ static Value *foldICmpWithLowBitMaskedVal(ICmpInst &I,
     M = Constant::replaceUndefsWith(VecC, SafeReplacementConstant);
   }
 
-  return Builder.CreateICmp(DstPred, X, M);
+  if (NeedsNot)
+    M = IC.Builder.CreateNot(M);
----------------
goldsteinn wrote:

If its freely invertable `(not M)` will simplify later on. Seems simpler to let the existing pipeline clean it up. No?

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


More information about the llvm-commits mailing list