[llvm] [InstCombine] Use known bits to simplify mask in foldSelectICmpAnd (PR #128741)

Julian Nagele via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 7 03:20:46 PST 2025


================
@@ -148,11 +149,13 @@ static Value *foldSelectICmpAnd(SelectInst &Sel, ICmpInst *Cmp,
   } else if (auto Res = decomposeBitTestICmp(Cmp->getOperand(0),
                                              Cmp->getOperand(1), Pred)) {
     assert(ICmpInst::isEquality(Res->Pred) && "Not equality test?");
-    if (!Res->Mask.isPowerOf2())
+    AndMask = Res->Mask;
+    V = Res->X;
+    KnownBits Known = computeKnownBits(V, 0, SQ.getWithInstruction(Cmp));
----------------
juliannagele wrote:

thanks, done

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


More information about the llvm-commits mailing list