[PATCH] D148362: [SLP]Fix cost estimation for buildvectors with extracts and/or constants.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 17 12:38:24 PDT 2023
ABataev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6976
}
- Cost -= TTI.getVectorInstrCost(*EE, EE->getVectorOperandType(), CostKind,
- Idx);
+ Cost -= TTI.getScalarizationOverhead(
+ EE->getVectorOperandType(),
----------------
dmgreen wrote:
> Is this to work around the AArch64 cost model?
Yes, because it has some kind of strange estimation if HasUse == false, the cost of insertelement is 0. Original cost estimation estimates the cost of the deleted extractelement instruction to be 3, while the insertelement instruction to be 0. Actually, it would be good to fix this problem in AArch64 cost model. The cost must be considered free, only if the operand0 is undef/poison, otherwise it is not zero.
I'm working on another solution, which should generate better shuffles, hope it will fix the regression for AArch64 and improve final emission for other targets.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148362/new/
https://reviews.llvm.org/D148362
More information about the llvm-commits
mailing list