1 ; RUN: opt %loadPolly -polly-print-dependences -disable-output < %s | FileCheck %s
3 ; CHECK: RAW dependences:
4 ; CHECK-NEXT: { Stmt_S1[i0, i1] -> Stmt_S2[-1 + i0 + i1] : 0 <= i0 <= 1023 and i1 >= 0 and -i0 < i1 <= 1024 - i0 and i1 <= 1023; Stmt_S0[i0] -> Stmt_S1[o0, i0 - o0] : i0 <= 1023 and 0 <= o0 <= i0 }
5 ; CHECK-NEXT: WAR dependences:
6 ; CHECK-NEXT: { Stmt_S1[i0, i1] -> Stmt_S2[i0 + i1] : i0 >= 0 and 0 <= i1 <= 1023 - i0; Stmt_S2[i0] -> Stmt_S2[1 + i0] : 0 <= i0 <= 1022 }
7 ; CHECK-NEXT: WAW dependences:
8 ; CHECK-NEXT: { Stmt_S1[i0, i1] -> Stmt_S2[i0 + i1] : i0 >= 0 and 0 <= i1 <= 1023 - i0; Stmt_S0[i0] -> Stmt_S1[o0, i0 - o0] : i0 <= 1023 and 0 <= o0 <= i0 }
9 ; CHECK-NEXT: Reduction dependences:
10 ; CHECK-NEXT: { Stmt_S1[i0, i1] -> Stmt_S1[1 + i0, -1 + i1] : 0 <= i0 <= 1022 and 0 < i1 <= 1023 }
13 ; for (int i = 0; i < 1024; i++)
15 ; for (int i = 0; i < 1024; i++)
16 ; for (int j = 0; j < 1024; j++)
17 ; S1: sum[i + j] += i;
18 ; for (int i = 0; i < 1024; i++)
19 ; S2: sum[i] = sumptr 3;
21 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
23 define void @f(ptr %sum) {
27 for.cond: ; preds = %for.inc, %entry
28 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
29 %exitcond3 = icmp ne i32 %i.0, 1024
30 br i1 %exitcond3, label %for.body, label %for.end
32 for.body: ; preds = %for.cond
35 S0: ; preds = %for.body
36 %arrayidx = getelementptr inbounds i32, ptr %sum, i32 %i.0
37 store i32 0, ptr %arrayidx, align 4
40 for.inc: ; preds = %S0
41 %inc = add nsw i32 %i.0, 1
44 for.end: ; preds = %for.cond
47 for.cond2: ; preds = %for.inc13, %for.end
48 %i1.0 = phi i32 [ 0, %for.end ], [ %inc14, %for.inc13 ]
49 %exitcond2 = icmp ne i32 %i1.0, 1024
50 br i1 %exitcond2, label %for.body4, label %for.end15
52 for.body4: ; preds = %for.cond2
55 for.cond5: ; preds = %for.inc10, %for.body4
56 %j.0 = phi i32 [ 0, %for.body4 ], [ %inc11, %for.inc10 ]
57 %exitcond1 = icmp ne i32 %j.0, 1024
58 br i1 %exitcond1, label %for.body7, label %for.end12
60 for.body7: ; preds = %for.cond5
63 S1: ; preds = %for.body7
64 %add = add nsw i32 %i1.0, %j.0
65 %arrayidx8 = getelementptr inbounds i32, ptr %sum, i32 %add
66 %tmp = load i32, ptr %arrayidx8, align 4
67 %add9 = add nsw i32 %tmp, %i1.0
68 store i32 %add9, ptr %arrayidx8, align 4
71 for.inc10: ; preds = %S1
72 %inc11 = add nsw i32 %j.0, 1
75 for.end12: ; preds = %for.cond5
78 for.inc13: ; preds = %for.end12
79 %inc14 = add nsw i32 %i1.0, 1
82 for.end15: ; preds = %for.cond2
85 for.cond17: ; preds = %for.inc23, %for.end15
86 %i16.0 = phi i32 [ 0, %for.end15 ], [ %inc24, %for.inc23 ]
87 %exitcond = icmp ne i32 %i16.0, 1024
88 br i1 %exitcond, label %for.body19, label %for.end25
90 for.body19: ; preds = %for.cond17
93 S2: ; preds = %for.body19
94 %add20 = add nsw i32 %i16.0, 1
95 %arrayidx21 = getelementptr inbounds i32, ptr %sum, i32 %add20
96 %tmp4 = load i32, ptr %arrayidx21, align 4
97 %mul = mul nsw i32 %tmp4, 3
98 %arrayidx22 = getelementptr inbounds i32, ptr %sum, i32 %i16.0
99 store i32 %mul, ptr %arrayidx22, align 4
102 for.inc23: ; preds = %S2
103 %inc24 = add nsw i32 %i16.0, 1
106 for.end25: ; preds = %for.cond17