Skip to content

Commit 52e5a38

Browse files
committed
Relax one use check for constants
1 parent 67fb3ea commit 52e5a38

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28017,8 +28017,9 @@ SDValue DAGCombiner::visitINSERT_SUBVECTOR(SDNode *N) {
2801728017
auto *BV0 = dyn_cast<BuildVectorSDNode>(N1);
2801828018
if (N0.isUndef() && (N1.getOpcode() == ISD::SPLAT_VECTOR || BV0)) {
2801928019
SDValue Splat = BV0 ? BV0->getSplatValue() : N1.getOperand(0);
28020-
if (Splat &&
28021-
(N1.hasOneUse() || (!BV0 && DAG.isConstantValueOfAnyType(Splat))))
28020+
bool SplatLegal = TLI.isOperationLegalOrCustom(ISD::SPLAT_VECTOR, VT);
28021+
if (Splat && (N1.hasOneUse() || (DAG.isConstantValueOfAnyType(Splat) &&
28022+
(!BV0 || SplatLegal))))
2802228023
return DAG.getNode(ISD::SPLAT_VECTOR, SDLoc(N), VT, N1.getOperand(0));
2802328024
}
2802428025

0 commit comments

Comments
 (0)