[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.
+ if (ST->hasVInstructions() && PtrTy->isVectorTy())
+ return getArithmeticInstrCost(Instruction::Add, PtrTy, CostKind,
+ {TTI::OK_AnyValue, TTI::OP_None},
+ {TTI::OK_AnyValue, TTI::OP_None}, {});
+
----------------
lukel97 wrote:
Does it work if we use the default arguments?
```suggestion
return getArithmeticInstrCost(Instruction::Add, PtrTy, CostKind);
```
https://github.com/llvm/llvm-project/pull/149955
More information about the llvm-commits
mailing list