1; RUN: opt -S %loadPolly -basic-aa -polly-dependences-analysis-type=value-based -polly-dce -polly-dce-precise-steps=2 -polly-ast -analyze < %s | FileCheck %s
2target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
3;
4; for(i = 0; i < 200; i++ )
5;   A[i] = 2;
6;
7; for (i = 0; i < 50; i++ )
8;   A[i]  = 5;
9;
10; for (i = 0; i < 70; i++ )
11;   A[i] = A[i] + 5;
12;
13; for (i = 100; i < 110; i++ )
14;   A[i] = i;
15;
16define void @main() nounwind uwtable {
17entry:
18  %A = alloca [200 x i32], align 16
19  br label %for.body.1
20
21for.body.1:
22  %indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %for.body.1 ]
23  %arrayidx.1 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.1
24  store i32 2, i32* %arrayidx.1, align 4
25  %indvar.next.1 = add i64 %indvar.1, 1
26  %exitcond.1 = icmp ne i64 %indvar.next.1, 200
27  br i1 %exitcond.1, label %for.body.1, label %exit.1
28
29exit.1:
30  br label %for.body.2
31
32for.body.2:
33  %indvar.2 = phi i64 [ 0, %exit.1 ], [ %indvar.next.2, %for.body.2 ]
34  %arrayidx.2 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.2
35  store i32 5, i32* %arrayidx.2, align 4
36  %indvar.next.2 = add i64 %indvar.2, 1
37  %exitcond.2 = icmp ne i64 %indvar.next.2, 50
38  br i1 %exitcond.2, label %for.body.2, label %exit.2
39
40exit.2:
41  br label %for.body.3
42
43for.body.3:
44  %indvar.3 = phi i64 [ 0, %exit.2 ], [ %indvar.next.3, %for.body.3 ]
45  %arrayidx.3 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.3
46  %val = load i32, i32* %arrayidx.3, align 4
47  %add = add nsw i32 %val, 5
48  store i32 %add, i32* %arrayidx.3, align 4
49  %indvar.next.3 = add i64 %indvar.3, 1
50  %exitcond.3 = icmp ne i64 %indvar.next.3, 70
51  br i1 %exitcond.3, label %for.body.3 , label %exit.3
52
53exit.3:
54  br label %for.body.4
55
56for.body.4:
57  %indvar.4 = phi i64 [ 0, %exit.3 ], [ %indvar.next.4, %for.body.4 ]
58  %indvar.plus = add i64 %indvar.4, 100
59  %trunc = trunc i64 %indvar.plus to i32
60  %arrayidx.4 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.plus
61  store i32 %trunc, i32* %arrayidx.4, align 4
62  %indvar.next.4 = add i64 %indvar.4, 1
63  %exitcond.4 = icmp ne i64 %indvar.next.4, 10
64  br i1 %exitcond.4, label %for.body.4, label %exit.4
65
66exit.4:
67  ret void
68}
69
70; CHECK: for (int c0 = 50; c0 <= 99; c0 += 1)
71; CHECK:   Stmt_for_body_1(c0);
72; CHECK: for (int c0 = 110; c0 <= 199; c0 += 1)
73; CHECK:   Stmt_for_body_1(c0);
74; CHECK: for (int c0 = 0; c0 <= 49; c0 += 1)
75; CHECK:   Stmt_for_body_2(c0);
76; CHECK: for (int c0 = 0; c0 <= 69; c0 += 1)
77; CHECK:   Stmt_for_body_3(c0);
78; CHECK: for (int c0 = 0; c0 <= 9; c0 += 1)
79