[llvm] [LV] Add cross-part load overlap heuristic for interleaving (PR #214500)

Sergey Shcherbinin via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 06:40:36 PDT 2026


================
@@ -904,6 +917,36 @@ class LoopVectorizationPlanner {
   /// been retired.
   InstructionCost cost(VPlan &Plan, ElementCount VF, VPRegisterUsage *RU) const;
 
+  /// Return whether cross-part CSE may participate in IC selection for this
+  /// loop.
+  ///
+  /// This is the loop-level policy gate: it checks the feature flag and
+  /// conditions independent of a particular VPlan/VF candidate, including
+  /// whether the loop is innermost, has no explicit interleave count, and does
+  /// not require partial-alias masking. A true result does not mean that a
+  /// supported or profitable cross-part opportunity has been found.
+  bool shouldUseCrossPartCSE() const;
----------------
SergeyShch01 wrote:

Agreed. I reworked this in the latest revision. The cross-part profitability check is now entirely local to selectInterleaveCount(), and runs only where regular UF selection would otherwise return 1. I removed the persistent recipe-cost cache and related planner plumbing; no cross-part state is retained between VF and UF selection.

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


More information about the llvm-commits mailing list