[llvm] 267329d - [LegalizeDAG] Simplify interface to PromoteReduction. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 30 09:48:52 PDT 2024
Author: Craig Topper
Date: 2024-04-30T09:48:41-07:00
New Revision: 267329d7e0e7dc6cb6d59b7d71290d5e5f5c6be2
URL: https://github.com/llvm/llvm-project/commit/267329d7e0e7dc6cb6d59b7d71290d5e5f5c6be2
DIFF: https://github.com/llvm/llvm-project/commit/267329d7e0e7dc6cb6d59b7d71290d5e5f5c6be2.diff
LOG: [LegalizeDAG] Simplify interface to PromoteReduction. NFC
Return an SDValue instead of pushing to the Results vector. Let
the caller do the push.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index d33366c44e4010..bfc3e08c1632de 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -185,7 +185,7 @@ class SelectionDAGLegalize {
/// All vector operands are promoted to a vector type with larger element
/// type, and the start value is promoted to a larger scalar type. Then the
/// result is truncated back to the original scalar type.
- void PromoteReduction(SDNode *Node, SmallVectorImpl<SDValue> &Results);
+ SDValue PromoteReduction(SDNode *Node);
SDValue ExpandPARITY(SDValue Op, const SDLoc &dl);
@@ -2991,8 +2991,7 @@ SDValue SelectionDAGLegalize::ExpandPARITY(SDValue Op, const SDLoc &dl) {
return DAG.getNode(ISD::AND, dl, VT, Result, DAG.getConstant(1, dl, VT));
}
-void SelectionDAGLegalize::PromoteReduction(SDNode *Node,
- SmallVectorImpl<SDValue> &Results) {
+SDValue SelectionDAGLegalize::PromoteReduction(SDNode *Node) {
MVT VecVT = Node->getOperand(1).getSimpleValueType();
MVT NewVecVT = TLI.getTypeToPromoteTo(Node->getOpcode(), VecVT);
MVT ScalarVT = Node->getSimpleValueType(0);
@@ -3026,10 +3025,8 @@ void SelectionDAGLegalize::PromoteReduction(SDNode *Node,
Node->getFlags());
assert(ScalarVT.isFloatingPoint() && "Only FP promotion is supported");
- Res = DAG.getNode(ISD::FP_ROUND, DL, ScalarVT, Res,
- DAG.getIntPtrConstant(0, DL, /*isTarget=*/true));
-
- Results.push_back(Res);
+ return DAG.getNode(ISD::FP_ROUND, DL, ScalarVT, Res,
+ DAG.getIntPtrConstant(0, DL, /*isTarget=*/true));
}
bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
@@ -5680,7 +5677,7 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
case ISD::VP_REDUCE_FMAX:
case ISD::VP_REDUCE_FMIN:
case ISD::VP_REDUCE_SEQ_FADD:
- PromoteReduction(Node, Results);
+ Results.push_back(PromoteReduction(Node));
break;
}
More information about the llvm-commits
mailing list