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

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 21:23:12 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())
----------------
phoebewang wrote:

Can we just exclude poison/undef or freeeze them instead?

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


More information about the llvm-commits mailing list