Skip to content

Commit 593f24c

Browse files
authored
[SelectionDAG] Clean up SCALAR_TO_VECTOR handling in SimplifyDemandedVectorElts (#157027)
This patch reverts changes from commit 585e65d (https://reviews.llvm.org/D104250), as it doesn't seem to be needed nowadays. The removed code was doing a recursive call to SimplifyDemandedVectorElts trying to simplify the vector %vec when finding things like (SCALAR_TO_VECTOR (EXTRACT_VECTOR_ELT %vec, 0)) I figure that (EXTRACT_VECTOR_ELT %vec, 0) would be simplified based on only demanding element zero regardless of being used in a SCALAR_TO_VECTOR operation or not. It had been different if the code tried to simplify the whole expression as %vec. That could also have motivate why to make element zero a special case. But it only simplified %vec without folding away the SCALAR_TO_VECTOR.
1 parent 2873d9f commit 593f24c

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,27 +3227,6 @@ bool TargetLowering::SimplifyDemandedVectorElts(
32273227
KnownUndef.setAllBits();
32283228
return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT));
32293229
}
3230-
SDValue ScalarSrc = Op.getOperand(0);
3231-
if (ScalarSrc.getOpcode() == ISD::EXTRACT_VECTOR_ELT) {
3232-
SDValue Src = ScalarSrc.getOperand(0);
3233-
SDValue Idx = ScalarSrc.getOperand(1);
3234-
EVT SrcVT = Src.getValueType();
3235-
3236-
ElementCount SrcEltCnt = SrcVT.getVectorElementCount();
3237-
3238-
if (SrcEltCnt.isScalable())
3239-
return false;
3240-
3241-
unsigned NumSrcElts = SrcEltCnt.getFixedValue();
3242-
if (isNullConstant(Idx)) {
3243-
APInt SrcDemandedElts = APInt::getOneBitSet(NumSrcElts, 0);
3244-
APInt SrcUndef = KnownUndef.zextOrTrunc(NumSrcElts);
3245-
APInt SrcZero = KnownZero.zextOrTrunc(NumSrcElts);
3246-
if (SimplifyDemandedVectorElts(Src, SrcDemandedElts, SrcUndef, SrcZero,
3247-
TLO, Depth + 1))
3248-
return true;
3249-
}
3250-
}
32513230
KnownUndef.setHighBits(NumElts - 1);
32523231
break;
32533232
}

0 commit comments

Comments
 (0)