[llvm] [LV][TTI] Calculate cost of extracting last index in a scalable vector (PR #144086)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 16 08:29:58 PDT 2025
================
@@ -1465,14 +1465,21 @@ class TargetTransformInfo {
OperandValueInfo Op2Info = {OK_AnyValue, OP_None},
const Instruction *I = nullptr) const;
+ enum : int {
+ UnknownIndex = -1,
+ LastIndex = -2,
----------------
lukel97 wrote:
It looks like one of the callers does the calculation whilst the other doesn't:
```c++
TTI.getVectorInstrCost(
Instruction::ExtractElement, VectorTy, CostKind,
VF.isScalable() ? TargetTransformInfo::LastIndex
: VF.getKnownMinValue() - 1));
```
I don't have a strong opinion on this btw, just seems like it might be easier to handle this in the callers since there's fewer of them than target hooks.
https://github.com/llvm/llvm-project/pull/144086
More information about the llvm-commits
mailing list