[llvm] [SLP] Account for GEP pointer-chain cost when root scalars feed load/store indices (PR #192726)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri May 1 10:22:48 PDT 2026
================
@@ -19073,6 +19093,41 @@ InstructionCost BoUpSLP::getTreeCost(InstructionCost TreeCost,
ExtractCost += ExtraCost;
}
+ // Charge the pointer-chain cost difference once for the root entry when
+ // every external use of its scalars is a GEP feeding a single load/store
+ // (see the detection loop above). Vectorizing the root in this pattern
+ // forces lane extracts (or a vector GEP with unknown stride) to drive the
+ // address computation, which is typically more expensive than keeping the
+ // indices scalar in a unit-stride address chain. Add the delta once rather
+ // than per external use.
----------------
alexey-bataev wrote:
I doubt we should do it. gathered loads still result in buildvector sequence. But if you're talking about masked gathers, this is different, these scalars are considered to be vectorized, so not accounted here
https://github.com/llvm/llvm-project/pull/192726
More information about the llvm-commits
mailing list