1; RUN: opt %loadNPMPolly '-passes=print<polly-dependences>' -disable-output < %s | FileCheck %s
2;
3; CHECK:      RAW dependences:
4; CHECK-NEXT:     { Stmt_for_body3[i0, i1] -> Stmt_for_body3[i0 + i1, o1] : i0 >= 0 and 0 <= i1 <= 1023 - i0 and i1 <= 1 and 0 < o1 <= 511 }
5; CHECK-NEXT: WAR dependences:
6; CHECK-NEXT:     {  }
7; CHECK-NEXT: WAW dependences:
8; CHECK-NEXT:     { Stmt_for_body3[i0, i1] -> Stmt_for_body3[1 + i0, -1 + i1] : 0 <= i0 <= 1022 and 2 <= i1 <= 511; Stmt_for_body3[i0, 2] -> Stmt_for_body3[2 + i0, 0] : 0 <= i0 <= 1021 }
9; CHECK-NEXT: Reduction dependences:
10; CHECK-NEXT:     { Stmt_for_body3[i0, 1] -> Stmt_for_body3[1 + i0, 0] : 0 <= i0 <= 1022 }
11;
12; void f(int *sum) {
13;   for (int i = 0; i < 1024; i++)
14;     for (int j = 0; j < 512; j++)
15;       sum[i + j] = sum[i] + 3;
16; }
17target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
18
19define void @f(ptr %sum) {
20entry:
21  br label %for.cond
22
23for.cond:                                         ; preds = %for.inc6, %entry
24  %i.0 = phi i32 [ 0, %entry ], [ %inc7, %for.inc6 ]
25  %exitcond1 = icmp ne i32 %i.0, 1024
26  br i1 %exitcond1, label %for.body, label %for.end8
27
28for.body:                                         ; preds = %for.cond
29  br label %for.cond1
30
31for.cond1:                                        ; preds = %for.inc, %for.body
32  %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
33  %exitcond = icmp ne i32 %j.0, 512
34  br i1 %exitcond, label %for.body3, label %for.end
35
36for.body3:                                        ; preds = %for.cond1
37  %arrayidx = getelementptr inbounds i32, ptr %sum, i32 %i.0
38  %tmp = load i32, ptr %arrayidx, align 4
39  %add = add nsw i32 %tmp, 3
40  %add4 = add nsw i32 %i.0, %j.0
41  %arrayidx5 = getelementptr inbounds i32, ptr %sum, i32 %add4
42  store i32 %add, ptr %arrayidx5, align 4
43  br label %for.inc
44
45for.inc:                                          ; preds = %for.body3
46  %inc = add nsw i32 %j.0, 1
47  br label %for.cond1
48
49for.end:                                          ; preds = %for.cond1
50  br label %for.inc6
51
52for.inc6:                                         ; preds = %for.end
53  %inc7 = add nsw i32 %i.0, 1
54  br label %for.cond
55
56for.end8:                                         ; preds = %for.cond
57  ret void
58}
59