[polly] r246477 - Do Not Model Unbounded Loops

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 12:58:24 PDT 2015


Author: jdoerfert
Date: Mon Aug 31 14:58:24 2015
New Revision: 246477

URL: http://llvm.org/viewvc/llvm-project?rev=246477&view=rev
Log:
Do Not Model Unbounded Loops

  Code generation currently does not expect unbounded loops. When
  using ISL to compute the loop trip count, if we find that the
  iteration domain remains unbounded, we invalidate the Scop by
  creating an infeasible context.

Contributed-by: Matthew Simpson <mssimpso at codeaurora.org>

This fixes PR24634.

Differential Revision: http://reviews.llvm.org/D12493


Modified:
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/test/ScopInfo/isl_trip_count_02.ll

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=246477&r1=246476&r2=246477&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon Aug 31 14:58:24 2015
@@ -903,9 +903,13 @@ void ScopStmt::addLoopBoundsToDomain(Tem
       isl_set *UpperBoundSet = isl_pw_aff_le_set(IV, UpperBound);
       Domain = isl_set_intersect(Domain, UpperBoundSet);
     } else {
-      // If SCEV cannot provide a loop trip count we compute it with ISL.
+      // If SCEV cannot provide a loop trip count, we compute it with ISL. If
+      // the domain remains unbounded, make the assumed context infeasible
+      // as code generation currently does not expect unbounded loops.
       addLoopTripCountToDomain(L);
       isl_pw_aff_free(IV);
+      if (!isl_set_dim_has_upper_bound(Domain, isl_dim_set, i))
+        Parent.addAssumption(isl_set_empty(Parent.getParamSpace()));
     }
   }
 

Modified: polly/trunk/test/ScopInfo/isl_trip_count_02.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/isl_trip_count_02.ll?rev=246477&r1=246476&r2=246477&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/isl_trip_count_02.ll (original)
+++ polly/trunk/test/ScopInfo/isl_trip_count_02.ll Mon Aug 31 14:58:24 2015
@@ -1,6 +1,8 @@
 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-allow-non-scev-backedge-taken-count -polly-scops -analyze < %s | FileCheck %s
 ;
-; CHECK: [M, N] -> { Stmt_for_body[i0] : i0 >= 0 and N <= -1 + M };
+; TODO: We do not allow unbounded loops at the moment.
+;
+; CHECK-NOT: Stmt_for_body
 ;
 ;   void f(int *A, int N, int M) {
 ;     for (int i = M; i > N; i++)




More information about the llvm-commits mailing list