1; RUN: opt -S %loadPolly -basic-aa -polly-dependences-analysis-type=value-based -polly-ast -analyze < %s | FileCheck %s
2; RUN: opt -S %loadPolly -basic-aa -polly-dependences-analysis-type=value-based -polly-dce -polly-ast -analyze < %s | FileCheck %s -check-prefix=CHECK-DCE
3target 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"
4;
5; for(i = 0; i < 200; i++ )
6;   A[i] = 2;
7;
8; for (i = 0; i < 200; i++ )
9;   B[i] = A[i];
10;
11; for (i = 0; i < 200; i++ )
12;   B[i] = A[i] = 5;
13define void @main() nounwind uwtable {
14entry:
15  %A = alloca [200 x i32], align 16
16  %B = alloca [200 x i32], align 16
17  br label %for.body.1
18
19for.body.1:
20  %indvar.1 = phi i64 [ 0, %entry ], [ %indvar.next.1, %for.body.1 ]
21  %arrayidx.1 = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.1
22  store i32 2, i32* %arrayidx.1, align 4
23  %indvar.next.1 = add i64 %indvar.1, 1
24  %exitcond.1 = icmp ne i64 %indvar.next.1, 200
25  br i1 %exitcond.1, label %for.body.1, label %exit.1
26
27exit.1:
28  br label %for.body.2
29
30for.body.2:
31  %indvar.2 = phi i64 [ 0, %exit.1 ], [ %indvar.next.2, %for.body.2 ]
32  %arrayidx.2.a = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.2
33  %val = load i32, i32* %arrayidx.2.a, align 4
34  %arrayidx.2.b = getelementptr [200 x i32], [200 x i32]* %B, i64 0, i64 %indvar.2
35  store i32 %val, i32* %arrayidx.2.b, align 4
36  %indvar.next.2 = add i64 %indvar.2, 1
37  %exitcond.2 = icmp ne i64 %indvar.next.2, 200
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.a = getelementptr [200 x i32], [200 x i32]* %A, i64 0, i64 %indvar.3
46  %arrayidx.3.b = getelementptr [200 x i32], [200 x i32]* %B, i64 0, i64 %indvar.3
47  store i32 5, i32* %arrayidx.3.a, align 4
48  store i32 5, i32* %arrayidx.3.b, align 4
49  %indvar.next.3 = add i64 %indvar.3, 1
50  %exitcond.3 = icmp ne i64 %indvar.next.3, 200
51  br i1 %exitcond.3, label %for.body.3 , label %exit.3
52
53exit.3:
54  ret void
55}
56
57; CHECK: for (int c0 = 0; c0 <= 199; c0 += 1)
58; CHECK:   Stmt_for_body_1(c0);
59; CHECK: for (int c0 = 0; c0 <= 199; c0 += 1)
60; CHECK:   Stmt_for_body_2(c0);
61; CHECK: for (int c0 = 0; c0 <= 199; c0 += 1)
62; CHECK:   Stmt_for_body_3(c0);
63
64; CHECK-DCE: for (int c0 = 0; c0 <= 199; c0 += 1)
65; CHECK-DCE:   Stmt_for_body_3(c0);
66