[llvm] [RISCV][TTI] Update cost and prevent exceed m8 for vector.extract.last.active (PR #188160)

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 24 18:52:00 PDT 2026


================
@@ -1733,9 +1733,19 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
     // Find a suitable type for a stepvector.
     ConstantRange VScaleRange(APInt(64, 1), APInt::getZero(64));
     unsigned EltWidth = getTLI()->getBitWidthForCttzElements(
-        MaskTy->getScalarType(), MaskTy->getElementCount(),
+        EVT(TLI->getVectorIdxTy(getDataLayout()))
+            .getTypeForEVT(MaskTy->getContext()),
+        MaskTy->getElementCount(),
         /*ZeroIsPoison=*/true, &VScaleRange);
     EltWidth = std::max(EltWidth, MaskTy->getScalarSizeInBits());
+
+    // Currently expandVectorFindLastActive cannot hanle step vector split.
----------------
ElvisWang123 wrote:

Fixed, thanks!

https://github.com/llvm/llvm-project/pull/188160


More information about the llvm-commits mailing list