[PATCH] D28044: [LV/LoopAccess] Check statically if an unknown dependence distance can be proven larger than the loop-count

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 09:11:29 PST 2017


anemet requested changes to this revision.
anemet added a comment.
This revision now requires changes to proceed.

Dorit, I am really sorry that it took me sooo much time to look at this for real.  The only thing that is missing is an LAA-specific test.



================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:1224-1229
+  // If we can prove that
+  //      (**) |dist_in_bytes| > takenCount * stepInBytes
+  // then there is no dependence.
+  // (this is equivalent to what the SIV data-dependence test would do).
+  const uint64_t ByteStride = Stride * TypeByteSize;
+  const SCEV *Step = SE.getConstant(BackedgeTakenCount.getType(), ByteStride);
----------------
Use the same variable names as in the formula or the other way?


================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:1241-1245
+  // Is (Dist > takenCount * stepInBytes) ?
+  // (If so, then we have proven (**) because |dist| >= dist)
+  const SCEV *Minus = SE.getMinusSCEV(CastedDist, CastedProduct);
+  if (SE.isKnownPositive(Minus))
+    return true;
----------------
The comment is actually slightly misleading since you perform subtraction to detect this.

@sanjoy, are these steps reasonably efficient to prove the property at line 1224 with SCEV?


================
Comment at: llvm/test/Transforms/LoopVectorize/pr31098.ll:1-2
+; REQUIRES: asserts
+; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 -enable-interleaved-mem-accesses=true -debug-only=loop-accesses < %s  2>&1 | FileCheck %s
+
----------------
Please add an LAA-only test in addition to this under Test/Analysis/LoopAccessAnalysis.


https://reviews.llvm.org/D28044





More information about the llvm-commits mailing list