[polly] r248126 - Add bounded loop assumption

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 20 09:38:20 PDT 2015


Author: jdoerfert
Date: Sun Sep 20 11:38:19 2015
New Revision: 248126

URL: http://llvm.org/viewvc/llvm-project?rev=248126&view=rev
Log:
Add bounded loop assumption

  So far we ignored the unbounded parts of the iteration domain, however
  we need to assume they do not occure at all to remain sound if they do.


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

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=248126&r1=248125&r2=248126&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Sun Sep 20 11:38:19 2015
@@ -1927,8 +1927,7 @@ void Scop::addLoopBoundsToHeaderDomain(L
 
   isl_set *UnboundedCtx = isl_set_params(Parts.first);
   isl_set *BoundedCtx = isl_set_complement(UnboundedCtx);
-  // TODO: Use the unbounded part to build runtime assumptions.
-  isl_set_free(BoundedCtx);
+  addAssumption(BoundedCtx);
 }
 
 void Scop::buildAliasChecks(AliasAnalysis &AA) {

Modified: polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll?rev=248126&r1=248125&r2=248126&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll (original)
+++ polly/trunk/test/ScopInfo/phi_scalar_simple_1.ll Sun Sep 20 11:38:19 2015
@@ -1,5 +1,14 @@
 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-scops -analyze < %s | FileCheck %s
 ;
+; The assumed context is tricky here as the equality test for the inner loop
+; allows an "unbounded" loop trip count. We assume that does not happen, thus
+; if N <= 1 the outer loop is not executed and we are done, if N >= 3 the
+; equality test in the inner exit condition will trigger at some point and,
+; finally, if N == 2 we would have an unbounded inner loop.
+;
+; CHECK:      Assumed Context:
+; CHECK-NEXT:   [N] -> {  : N >= 3 or N <= 1 }
+;
 ;    int jd(int *restrict A, int x, int N) {
 ;      for (int i = 1; i < N; i++)
 ;        for (int j = 3; j < N; j++)




More information about the llvm-commits mailing list