[PATCH] D9444: Use ISL to Determine Loop Trip Count

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 07:02:55 PDT 2015


mssimpso marked 4 inline comments as done.

================
Comment at: lib/Analysis/ScopDetection.cpp:784
@@ +783,3 @@
+        (isa<SCEVAddRecExpr>(RHS) && !isInvariant(*Op0, CurRegion)))
+      return false;
+  }
----------------
jdoerfert wrote:
> For now we can be restrictive but could you explain to me why do we need this part? I want to refactor the Domain creation soon and any information you have would be usefull.
Without the invariant check, we were hitting cases like for (int i=0; i < A[i]; i++) (e.g., in test/ScopDetect/non-affine-loop.ll). This was previously rejected because the trip count could not be computed by SCEV.

================
Comment at: lib/Analysis/ScopDetection.cpp:798
@@ -732,4 +797,3 @@
   // Is the loop count affine?
-  const SCEV *LoopCount = SE->getBackedgeTakenCount(L);
-  if (isAffineExpr(&Context.CurRegion, LoopCount, *SE)) {
+  if (canUseSCEVTripCount(L, Context) || canUseISLTripCount(L, Context)) {
     Context.hasAffineLoops = true;
----------------
I think the refactoring was a bit too aggressive here. If the trip count is computable by SCEV, but it is not affine, we still need to reject. I will post an update shortly.


http://reviews.llvm.org/D9444





More information about the llvm-commits mailing list