1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
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.
9 ; CHECK: Assumed Context:
10 ; CHECK-NEXT: [N] -> { : }
11 ; CHECK: Invalid Context:
12 ; CHECK-NEXT: [N] -> { : N = 2 }
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++)
21 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23 define i32 @jd(ptr noalias %A, i32 %x, i32 %N) {
25 %tmp = sext i32 %N to i64
28 for.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
34 for.body: ; preds = %for.cond
37 for.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
43 for.body3: ; preds = %for.cond1
46 for.inc: ; preds = %for.body3
47 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
48 %tmp1 = load i32, ptr %arrayidx, align 4
49 %add = add nsw i32 %x.addr.1, %tmp1
50 %inc = add i32 %j.0, 1
53 for.end: ; preds = %for.cond1
54 %x.addr.1.lcssa = phi i32 [ %x.addr.1, %for.cond1 ]
57 for.inc4: ; preds = %for.end
58 %indvars.iv.next = add i64 %indvars.iv, 1
61 for.end6: ; preds = %for.cond