Skip to content

Commit 267329d

Browse files
committed
[LegalizeDAG] Simplify interface to PromoteReduction. NFC
Return an SDValue instead of pushing to the Results vector. Let the caller do the push.
1 parent 4631e7b commit 267329d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class SelectionDAGLegalize {
185185
/// All vector operands are promoted to a vector type with larger element
186186
/// type, and the start value is promoted to a larger scalar type. Then the
187187
/// result is truncated back to the original scalar type.
188-
void PromoteReduction(SDNode *Node, SmallVectorImpl<SDValue> &Results);
188+
SDValue PromoteReduction(SDNode *Node);
189189

190190
SDValue ExpandPARITY(SDValue Op, const SDLoc &dl);
191191

@@ -2991,8 +2991,7 @@ SDValue SelectionDAGLegalize::ExpandPARITY(SDValue Op, const SDLoc &dl) {
29912991
return DAG.getNode(ISD::AND, dl, VT, Result, DAG.getConstant(1, dl, VT));
29922992
}
29932993

2994-
void SelectionDAGLegalize::PromoteReduction(SDNode *Node,
2995-
SmallVectorImpl<SDValue> &Results) {
2994+
SDValue SelectionDAGLegalize::PromoteReduction(SDNode *Node) {
29962995
MVT VecVT = Node->getOperand(1).getSimpleValueType();
29972996
MVT NewVecVT = TLI.getTypeToPromoteTo(Node->getOpcode(), VecVT);
29982997
MVT ScalarVT = Node->getSimpleValueType(0);
@@ -3026,10 +3025,8 @@ void SelectionDAGLegalize::PromoteReduction(SDNode *Node,
30263025
Node->getFlags());
30273026

30283027
assert(ScalarVT.isFloatingPoint() && "Only FP promotion is supported");
3029-
Res = DAG.getNode(ISD::FP_ROUND, DL, ScalarVT, Res,
3030-
DAG.getIntPtrConstant(0, DL, /*isTarget=*/true));
3031-
3032-
Results.push_back(Res);
3028+
return DAG.getNode(ISD::FP_ROUND, DL, ScalarVT, Res,
3029+
DAG.getIntPtrConstant(0, DL, /*isTarget=*/true));
30333030
}
30343031

30353032
bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
@@ -5680,7 +5677,7 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
56805677
case ISD::VP_REDUCE_FMAX:
56815678
case ISD::VP_REDUCE_FMIN:
56825679
case ISD::VP_REDUCE_SEQ_FADD:
5683-
PromoteReduction(Node, Results);
5680+
Results.push_back(PromoteReduction(Node));
56845681
break;
56855682
}
56865683

0 commit comments

Comments
 (0)