[llvm] [X86] combineOr - don't undemand an element if the other operand's element is allones (PR #215538)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 02:40:34 PDT 2026


================
@@ -53856,29 +53856,6 @@ static SDValue combineOr(SDNode *N, SelectionDAG &DAG,
     SDValue Op(N, 0);
     if (SDValue Res = combineX86ShufflesRecursively(Op, DAG, Subtarget))
       return Res;
-
-    // If either operand is a constant mask, then only the elements that aren't
-    // allones are actually demanded by the other operand.
-    auto SimplifyUndemandedElts = [&](SDValue Op, SDValue OtherOp) {
-      APInt UndefElts;
-      SmallVector<APInt> EltBits;
-      int NumElts = VT.getVectorNumElements();
-      int EltSizeInBits = VT.getScalarSizeInBits();
-      if (!getTargetConstantBitsFromNode(Op, EltSizeInBits, UndefElts, EltBits))
-        return false;
-
-      APInt DemandedElts = APInt::getZero(NumElts);
-      for (int I = 0; I != NumElts; ++I)
-        if (!EltBits[I].isAllOnes())
----------------
RKSimon wrote:

Yes, I'm hoping that will work - I just made this patch as a bugfix, but I'll add the tweaks as well.

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


More information about the llvm-commits mailing list