[llvm] [CostModel][AArch64] Make extractelement, with fmul user, free whenev… (PR #111479)
Sushant Gokhale via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 6 02:50:40 PST 2024
================
@@ -1392,6 +1393,16 @@ class TargetTransformInfo {
unsigned Index = -1, Value *Op0 = nullptr,
Value *Op1 = nullptr) const;
+ /// \return The expected cost of vector Insert and Extract.
+ /// Use -1 to indicate that there is no information on the index value.
+ /// This is used when the instruction is not available; a typical use
+ /// case is to provision the cost of vectorization/scalarization in
+ /// vectorizer passes.
+ InstructionCost getVectorInstrCost(
+ unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
+ Value *Scalar,
+ ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx) const;
----------------
sushgokh wrote:
>I don't know of a better way of passing the information this needs,
Extract information passed to the backend is not substantial. Tried using Densemap to record such information but then it creates complications in terms of API declaration unnecessarily. Also, since the information passed is not much, finding the information in the array does not impose compile time overhead.
But yes, will try to describe this information in more detail in non-slp specific manner.
>From the cases, its quite clear that we cant simply say that "extract to fmul is free" because it depends on how the extract is used elsewhere.
> Maybe we just need to work on reducing the cost of an fp extract to 1.
Not sure on this. I suspect reducing the cost to 1 might cause excessive extracts(I had given it a try but it causes excessive churn). This patch goes even further to reduce the cost to 0 and fortunately this patch is not imposing compile time overhead.
>I wasn't able to look at this patch as much as I would have liked as all the tests are failing.
I havent rebased it. Sorry. Will rebase it.
https://github.com/llvm/llvm-project/pull/111479
More information about the llvm-commits
mailing list