[llvm] [LAA] Add stencil group merging to reduce runtime pointer checks (PR #187252)

Igor Kirillov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 05:55:22 PDT 2026


================
@@ -1465,10 +1545,19 @@ void RuntimePointerChecking::mergeStencilGroups(PredicatedScalarEvolution &PSE,
     // Build the merged group and register its positive-stride predicates.
     NewMergedGroups.push_back(buildMergedStencilGroup(
         *this, PSE, AllMembers, MergedLow, MergedHigh, GroupIndices,
-        LocalStridesNeedingPreds.getArrayRef(), CommittedStridePredicates));
+        LocalStrideLowerLimits.getArrayRef(), StrideLowerLimits));
+    for (const auto &[Stride, UpperLimit] : LocalStrideUpperLimits) {
+      auto [It, Inserted] = StrideUpperLimits.insert({Stride, UpperLimit});
+      if (!Inserted && UpperLimit.ult(It->second))
+        It->second = UpperLimit;
----------------
igogo-x86 wrote:

Changed test `shared_stride_predicate_dedup` to cover this now:

`%a`  reads at `{-cdj, 0, +cdj}`
`%b`  reads at `{-2*cdj, 0, +2*cdj}`.

The `%a` DepSet is merged first and needs `cdj <= 4611686018427387903` (2^62 - 1). 
The `%b` DepSet needs `cdj <= 2305843009213693951` (2^61 - 1).
The output has one `sle` predicate, with the smaller value.

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


More information about the llvm-commits mailing list