Skip to content

Commit 10b49fb

Browse files
RKSimonchencha3
authored andcommitted
[DAG] combineConcatVectorOfScalars - stop always creating UNDEF nodes. NFC.
Noticed in debug logs - most calls to visitVECTOR_SHUFFLE resulted into wasteful UNDEF node creations, despite almost never being used.
1 parent bd259b0 commit 10b49fb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23447,9 +23447,7 @@ static SDValue combineConcatVectorOfScalars(SDNode *N, SelectionDAG &DAG) {
2344723447
SDLoc DL(N);
2344823448
EVT VT = N->getValueType(0);
2344923449
SmallVector<SDValue, 8> Ops;
23450-
2345123450
EVT SVT = EVT::getIntegerVT(*DAG.getContext(), OpVT.getSizeInBits());
23452-
SDValue ScalarUndef = DAG.getNode(ISD::UNDEF, DL, SVT);
2345323451

2345423452
// Keep track of what we encounter.
2345523453
bool AnyInteger = false;
@@ -23459,7 +23457,7 @@ static SDValue combineConcatVectorOfScalars(SDNode *N, SelectionDAG &DAG) {
2345923457
!Op.getOperand(0).getValueType().isVector())
2346023458
Ops.push_back(Op.getOperand(0));
2346123459
else if (ISD::UNDEF == Op.getOpcode())
23462-
Ops.push_back(ScalarUndef);
23460+
Ops.push_back(DAG.getNode(ISD::UNDEF, DL, SVT));
2346323461
else
2346423462
return SDValue();
2346523463

@@ -23479,13 +23477,12 @@ static SDValue combineConcatVectorOfScalars(SDNode *N, SelectionDAG &DAG) {
2347923477
// Replace UNDEFs by another scalar UNDEF node, of the final desired type.
2348023478
if (AnyFP) {
2348123479
SVT = EVT::getFloatingPointVT(OpVT.getSizeInBits());
23482-
ScalarUndef = DAG.getNode(ISD::UNDEF, DL, SVT);
2348323480
if (AnyInteger) {
2348423481
for (SDValue &Op : Ops) {
2348523482
if (Op.getValueType() == SVT)
2348623483
continue;
2348723484
if (Op.isUndef())
23488-
Op = ScalarUndef;
23485+
Op = DAG.getNode(ISD::UNDEF, DL, SVT);
2348923486
else
2349023487
Op = DAG.getBitcast(SVT, Op);
2349123488
}

0 commit comments

Comments
 (0)