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.

llvm-svn: 248126
This commit is contained in:
Johannes Doerfert 2015-09-20 16:38:19 +00:00
parent f2cc86edae
commit 707a406078
2 changed files with 10 additions and 2 deletions

View File

@ -1927,8 +1927,7 @@ void Scop::addLoopBoundsToHeaderDomain(Loop *L, LoopInfo &LI) {
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) {

View File

@ -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++)