[llvm] [llvm][RISCV] Do not assume V extension on seeing vector type. (PR #166994)

Chenguang Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 11:17:07 PST 2025


================
@@ -2140,8 +2140,9 @@ InstructionCost RISCVTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
   // Assume memory ops cost scale with the number of vector registers
   // possible accessed by the instruction.  Note that BasicTTI already
   // handles the LT.first term for us.
-  if (LT.second.isVector() && CostKind != TTI::TCK_CodeSize)
-    BaseCost *= TLI->getLMULCost(LT.second);
+  if (TLI->getSubtarget().hasVInstructions())
+    if (LT.second.isVector() && CostKind != TTI::TCK_CodeSize)
----------------
wecing wrote:

Done, thanks for pointing out.

It seems like there are actually a lot of `ST->hasVInstructions()` checks in the file, so it seems like we are doing the right thing here.

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


More information about the llvm-commits mailing list