Skip to content

Commit f071073

Browse files
authored
[DAGCombiner] Pass SDNodeFlags to getSelect instead of modifying the node returned. (#148733)
1 parent 6b7c6fd commit f071073

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,9 +2606,7 @@ SDValue DAGCombiner::foldBinOpIntoSelect(SDNode *BO) {
26062606
return SDValue();
26072607
}
26082608

2609-
SDValue SelectOp = DAG.getSelect(DL, VT, Sel.getOperand(0), NewCT, NewCF);
2610-
SelectOp->setFlags(BO->getFlags());
2611-
return SelectOp;
2609+
return DAG.getSelect(DL, VT, Sel.getOperand(0), NewCT, NewCF, BO->getFlags());
26122610
}
26132611

26142612
static SDValue foldAddSubBoolOfMaskedVal(SDNode *N, const SDLoc &DL,
@@ -12191,11 +12189,8 @@ SDValue DAGCombiner::visitSELECT(SDNode *N) {
1219112189
return V;
1219212190

1219312191
// select (not Cond), N1, N2 -> select Cond, N2, N1
12194-
if (SDValue F = extractBooleanFlip(N0, DAG, TLI, false)) {
12195-
SDValue SelectOp = DAG.getSelect(DL, VT, F, N2, N1);
12196-
SelectOp->setFlags(Flags);
12197-
return SelectOp;
12198-
}
12192+
if (SDValue F = extractBooleanFlip(N0, DAG, TLI, false))
12193+
return DAG.getSelect(DL, VT, F, N2, N1, Flags);
1219912194

1220012195
if (SDValue V = foldSelectOfConstants(N))
1220112196
return V;
@@ -28343,10 +28338,8 @@ SDValue DAGCombiner::SimplifySelect(const SDLoc &DL, SDValue N0, SDValue N1,
2834328338
SCC.getOperand(0), SCC.getOperand(1),
2834428339
SCC.getOperand(4), Flags);
2834528340
AddToWorklist(SETCC.getNode());
28346-
SDValue SelectNode = DAG.getSelect(SDLoc(SCC), SCC.getValueType(), SETCC,
28347-
SCC.getOperand(2), SCC.getOperand(3));
28348-
SelectNode->setFlags(Flags);
28349-
return SelectNode;
28341+
return DAG.getSelect(SDLoc(SCC), SCC.getValueType(), SETCC,
28342+
SCC.getOperand(2), SCC.getOperand(3), Flags);
2835028343
}
2835128344

2835228345
return SCC;

0 commit comments

Comments
 (0)