[llvm] [LAA] Enable diff checks for non-unit constant stride (PR #188826)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 1 00:46:11 PDT 2026


================
@@ -2273,33 +2273,49 @@ Value *llvm::addDiffRuntimeChecks(
   // Map to keep track of created compares, The key is the pair of operands for
   // the compare, to allow detecting and re-using redundant compares.
   DenseMap<std::pair<Value *, Value *>, Value *> SeenCompares;
-  // Cache of (VF * IC * AccessSize) - 1, shared across checks with matching
-  // type and IC*AccessSize to avoid emitting duplicate runtime computations.
-  DenseMap<std::pair<Type *, unsigned>, Value *> ThresholdCache;
-  for (const auto &[SrcStart, SinkStart, AccessSize, NeedsFreeze] : Checks) {
+  // Cache of (VF*IC*Stride-(Stride-AccessSize)) - 1, shared across checks with
+  // matching type/IC/Stride to avoid emitting duplicate runtime computations.
+  DenseMap<
+      std::tuple<Type *, unsigned /*IC*/, unsigned /*AbsCommonStrideInBytes*/>,
----------------
fhahn wrote:

I think we are missing the `AccessSize` as cache key here? If we have same stride but different access sizes, we may re-use an incorrect threshold?

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


More information about the llvm-commits mailing list