[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
Tue May 5 13:55:41 PDT 2026


================
@@ -19278,6 +19301,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
----------------
alexey-bataev wrote:

Yes.

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


More information about the llvm-commits mailing list