1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s 2; 3; The assumed context is tricky here as the equality test for the inner loop 4; allows an "unbounded" loop trip count. We assume that does not happen, thus 5; if N <= 1 the outer loop is not executed and we are done, if N >= 3 the 6; equality test in the inner exit condition will trigger at some point and, 7; finally, if N == 2 we would have an unbounded inner loop. 8; 9; CHECK: Assumed Context: 10; CHECK-NEXT: [N] -> { : } 11; CHECK: Invalid Context: 12; CHECK-NEXT: [N] -> { : N = 2 } 13; 14; int jd(int *restrict A, int x, int N) { 15; for (int i = 1; i < N; i++) 16; for (int j = 3; j < N; j++) 17; x += A[i]; 18; return x; 19; } 20; 21target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 22 23define i32 @jd(i32* noalias %A, i32 %x, i32 %N) { 24entry: 25 %tmp = sext i32 %N to i64 26 br label %for.cond 27 28for.cond: ; preds = %for.inc4, %entry 29 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc4 ], [ 1, %entry ] 30 %x.addr.0 = phi i32 [ %x, %entry ], [ %x.addr.1.lcssa, %for.inc4 ] 31 %cmp = icmp slt i64 %indvars.iv, %tmp 32 br i1 %cmp, label %for.body, label %for.end6 33 34for.body: ; preds = %for.cond 35 br label %for.cond1 36 37for.cond1: ; preds = %for.inc, %for.body 38 %x.addr.1 = phi i32 [ %x.addr.0, %for.body ], [ %add, %for.inc ] 39 %j.0 = phi i32 [ 3, %for.body ], [ %inc, %for.inc ] 40 %exitcond = icmp ne i32 %j.0, %N 41 br i1 %exitcond, label %for.body3, label %for.end 42 43for.body3: ; preds = %for.cond1 44 br label %for.inc 45 46for.inc: ; preds = %for.body3 47 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 48 %tmp1 = load i32, i32* %arrayidx, align 4 49 %add = add nsw i32 %x.addr.1, %tmp1 50 %inc = add i32 %j.0, 1 51 br label %for.cond1 52 53for.end: ; preds = %for.cond1 54 %x.addr.1.lcssa = phi i32 [ %x.addr.1, %for.cond1 ] 55 br label %for.inc4 56 57for.inc4: ; preds = %for.end 58 %indvars.iv.next = add i64 %indvars.iv, 1 59 br label %for.cond 60 61for.end6: ; preds = %for.cond 62 ret i32 %x.addr.0 63} 64