[llvm] [CostModel][AArch64] Make extractelement, with fmul user, free whenev… (PR #111479)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 04:00:23 PDT 2024


================
@@ -11739,8 +11750,9 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
       ExtraCost = TTI->getExtractWithExtendCost(Extend, EU.Scalar->getType(),
                                                 VecTy, EU.Lane);
     } else {
-      ExtraCost = TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy,
-                                          CostKind, EU.Lane);
+      ExtraCost = TTI->getVectorInstrCost(
+          Instruction::ExtractElement, VecTy, CostKind, EU.Lane, nullptr,
----------------
david-arm wrote:

Yeah I agree, but all the calls to `getVectorInstrCost` elsewhere in this file are invoking a different interface to this new one, right? For example, calls like this:

```
        InstructionCost InsertFirstCost = TTI->getVectorInstrCost(
            Instruction::InsertElement, Ty, TTI::TCK_RecipThroughput, 0,
            PoisonValue::get(Ty), *It);
```

but calls like this don't seem to end up calling your new interface.

I can see that in BasicTTIImpl you have changed the pre-existing interface to be virtual:

```
  virtual InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
                                             TTI::TargetCostKind CostKind,
                                             unsigned Index, Value *Op0,
                                             Value *Op1) {
    return getRegUsageForType(Val->getScalarType());
  }
```

but it's not obvious to me where it gets overridden to call your new interface.

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


More information about the llvm-commits mailing list