1; RUN: opt %loadPolly -polly-dependences -analyze -basic-aa < %s | FileCheck %s
2;
3; CHECK:      RAW dependences:
4; CHECK-NEXT:     {  }
5; CHECK-NEXT: WAR dependences:
6; CHECK-NEXT:     {  }
7; CHECK-NEXT: WAW dependences:
8; CHECK-NEXT:     {  }
9; CHECK-NEXT: Reduction dependences:
10; CHECK-NEXT:     { Stmt_for_body3[i0, i1] -> Stmt_for_body3[i0, 1 + i1] : 0 <= i0 <= 99 and 0 <= i1 <= 98; Stmt_for_body3[i0, 99] -> Stmt_for_body3[1 + i0, 0] : 0 <= i0 <= 98 }
11;
12; int f(int * restrict A, int * restrict sum) {
13;   int i, j, k;
14;   for (i = 0; i < 100; i++) {
15;     for (j = 0; j < 100; j++) {
16;       sum += A[i+j];
17;       for (k = 0; k< 100; k++) {}
18;     }
19;   }
20;   return sum;
21; }
22target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
23
24define void @f(i32* noalias %A, i32* noalias %sum) {
25entry:
26  br label %for.cond
27
28for.cond:                                         ; preds = %for.inc11, %entry
29  %i.0 = phi i32 [ 0, %entry ], [ %inc12, %for.inc11 ]
30  %exitcond2 = icmp ne i32 %i.0, 100
31  br i1 %exitcond2, label %for.body, label %for.end13
32
33for.body:                                         ; preds = %for.cond
34  br label %for.cond1
35
36for.cond1:                                        ; preds = %for.inc8, %for.body
37  %j.0 = phi i32 [ 0, %for.body ], [ %inc9, %for.inc8 ]
38  %exitcond1 = icmp ne i32 %j.0, 100
39  br i1 %exitcond1, label %for.body3, label %for.end10
40
41for.body3:                                        ; preds = %for.cond1
42  %add = add nsw i32 %i.0, %j.0
43  %arrayidx = getelementptr inbounds i32, i32* %A, i32 %add
44  %tmp3 = load i32, i32* %arrayidx, align 4
45  %tmp4 = load i32, i32* %sum, align 4
46  %add4 = add nsw i32 %tmp4, %tmp3
47  store i32 %add4, i32* %sum, align 4
48  br label %for.cond5
49
50for.cond5:                                        ; preds = %for.inc, %for.body3
51  %k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
52  %exitcond = icmp ne i32 %k.0, 100
53  br i1 %exitcond, label %for.body7, label %for.end
54
55for.body7:                                        ; preds = %for.cond5
56  br label %for.inc
57
58for.inc:                                          ; preds = %for.body7
59  %inc = add nsw i32 %k.0, 1
60  br label %for.cond5
61
62for.end:                                          ; preds = %for.cond5
63  br label %for.inc8
64
65for.inc8:                                         ; preds = %for.end
66  %inc9 = add nsw i32 %j.0, 1
67  br label %for.cond1
68
69for.end10:                                        ; preds = %for.cond1
70  br label %for.inc11
71
72for.inc11:                                        ; preds = %for.end10
73  %inc12 = add nsw i32 %i.0, 1
74  br label %for.cond
75
76for.end13:                                        ; preds = %for.cond
77  ret void
78}
79