[PATCH] D127939: [LegalizeTypes][RISCV][NFC] Modify assert in PromoteIntRes_STEP_VECTOR and add some tests for RISCV

WangLian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 02:24:44 PDT 2022


Jimerlife added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:5280
   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");
----------------
david-arm wrote:
> Jimerlife wrote:
> > craig.topper wrote:
> > > Why this change? llvm.stepvector intrinsic works for fixed vectors.
> > Yes, llvm.stepvector intrinsic works for fixed vectors, but ISD::STEP_VECTOR is only work for scalable vector. I'm not sure my understanding is right?
> I agree with @craig.topper. I don't understand why we're changing the assert here. This should work for fixed vectors too so we should be asserting that the result is a vector, i.e. either fixed-width or scalable.
If call `<vscale x 4 x i15> @llvm.experimental.stepvector.nxv4i15()`, it generated `nxv4i15 = step_vector` node. 
But if call `<4 x i15> @llvm.experimental.stepvector.v4i15()`, it generated `v4i15 = build_vector` node.

My understand is that fixed vectors cann't generate node like `v4i15 = step_vector`.
So, only scalable vector will go through PromoteIntRes_STEP_VECTOR if it need to promote.
This is right? @craig.topper  @david-arm


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127939/new/

https://reviews.llvm.org/D127939



More information about the llvm-commits mailing list