[llvm] [RISCV][TTI] Implement getAddressComputationCost() in RISCV TTI. (PR #149955)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 23:02:08 PDT 2025


================
@@ -1566,6 +1566,20 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
   return BaseT::getIntrinsicInstrCost(ICA, CostKind);
 }
 
+InstructionCost
+RISCVTTIImpl::getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE,
+                                        const SCEV *Ptr,
+                                        TTI::TargetCostKind CostKind) const {
+  // Address computations with vector type are usually for indexed load/store
+  // which is likely more expensive.
----------------
lukel97 wrote:

Nit, I think it it's not the index load/store that's more expensive but the need to sometimes emit a vadd.vv/vsll.vi when lowering the vector GEP
```suggestion
  // Address computations for vector indexed load/store likely require an offset and/or scaling.
```

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


More information about the llvm-commits mailing list