diff options
| author | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
| commit | 95fbfc9be5d2842a945c04a20fe6244df9b10e18 (patch) | |
| tree | 00f80558d11aa5805e6d6f290663c6da44e5e6ef /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
| parent | a9ba028b98ffd53d9c7d00ca7563d74810fcf6e7 (diff) | |
| parent | 17e8465a3eb0cae48b9f62d27fd26f2b070f1f9b (diff) | |
[𝘀𝗽𝗿] changes introduced through rebaseusers/MaskRay/spr/main.move-relocation-specifier-constants-to-aarch64
Created using spr 1.3.5-bogner
[skip ci]
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 52f19cc6e1ab..1e470318ced0 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -11413,13 +11413,9 @@ SDValue TargetLowering::expandVecReduce(SDNode *Node, SelectionDAG &DAG) const { SDValue Op = Node->getOperand(0); EVT VT = Op.getValueType(); - if (VT.isScalableVector()) - report_fatal_error( - "Expanding reductions for scalable vectors is undefined."); - // Try to use a shuffle reduction for power of two vectors. if (VT.isPow2VectorType()) { - while (VT.getVectorNumElements() > 1) { + while (VT.getVectorElementCount().isKnownMultipleOf(2)) { EVT HalfVT = VT.getHalfNumVectorElementsVT(*DAG.getContext()); if (!isOperationLegalOrCustom(BaseOpcode, HalfVT)) break; @@ -11428,9 +11424,18 @@ SDValue TargetLowering::expandVecReduce(SDNode *Node, SelectionDAG &DAG) const { std::tie(Lo, Hi) = DAG.SplitVector(Op, dl); Op = DAG.getNode(BaseOpcode, dl, HalfVT, Lo, Hi, Node->getFlags()); VT = HalfVT; + + // Stop if splitting is enough to make the reduction legal. + if (isOperationLegalOrCustom(Node->getOpcode(), HalfVT)) + return DAG.getNode(Node->getOpcode(), dl, Node->getValueType(0), Op, + Node->getFlags()); } } + if (VT.isScalableVector()) + reportFatalInternalError( + "Expanding reductions for scalable vectors is undefined."); + EVT EltVT = VT.getVectorElementType(); unsigned NumElts = VT.getVectorNumElements(); |
