From 16215eb9790ac47e1f628ec7fdcb237df0adbb23 Mon Sep 17 00:00:00 2001 From: Lian Wang Date: Thu, 16 Jun 2022 03:31:48 +0000 Subject: [PATCH] [LegalizeTypes][RISCV][NFC] Modify assert in PromoteIntRes_STEP_VECTOR and add some tests for RISCV Reviewed By: david-arm Differential Revision: https://reviews.llvm.org/D127939 --- llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 3 ++- llvm/test/CodeGen/RISCV/rvv/stepvector.ll | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index a4198c4..4df73e6 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -5277,7 +5277,8 @@ SDValue DAGTypeLegalizer::PromoteIntRes_STEP_VECTOR(SDNode *N) { SDLoc dl(N); EVT OutVT = N->getValueType(0); EVT NOutVT = TLI.getTypeToTransformTo(*DAG.getContext(), OutVT); - assert(NOutVT.isVector() && "Type must be promoted to a vector type"); + assert(NOutVT.isScalableVector() && + "Type must be promoted to a scalable vector type"); APInt StepVal = cast(N->getOperand(0))->getAPIntValue(); return DAG.getStepVector(dl, NOutVT, StepVal.sext(NOutVT.getScalarSizeInBits())); diff --git a/llvm/test/CodeGen/RISCV/rvv/stepvector.ll b/llvm/test/CodeGen/RISCV/rvv/stepvector.ll index 61e1386..e94a8a4 100644 --- a/llvm/test/CodeGen/RISCV/rvv/stepvector.ll +++ b/llvm/test/CodeGen/RISCV/rvv/stepvector.ll @@ -167,6 +167,18 @@ define @stepvector_nxv2i16() { ret %v } +declare @llvm.experimental.stepvector.nxv2i15() + +define @stepvector_nxv2i15() { +; CHECK-LABEL: stepvector_nxv2i15: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, mu +; CHECK-NEXT: vid.v v8 +; CHECK-NEXT: ret + %v = call @llvm.experimental.stepvector.nxv2i15() + ret %v +} + declare @llvm.experimental.stepvector.nxv3i16() define @stepvector_nxv3i16() { @@ -515,7 +527,6 @@ entry: ret %3 } - define @shl_stepvector_nxv8i64() { ; CHECK-LABEL: shl_stepvector_nxv8i64: ; CHECK: # %bb.0: # %entry -- 2.7.4