1 ; RUN: opt %loadNPMPolly '-passes=print<polly-dependences>' -disable-output < %s | FileCheck %s
3 ; CHECK: RAW dependences:
4 ; CHECK-NEXT: { Stmt_S1[i0, 0] -> Stmt_S2[i0, 0] : 0 <= i0 <= 98; Stmt_S2[i0, 0] -> Stmt_S1[1 + i0, 0] : 0 <= i0 <= 97 }
5 ; CHECK-NEXT: WAR dependences:
6 ; CHECK-NEXT: { Stmt_S1[i0, 0] -> Stmt_S2[i0, 0] : 0 <= i0 <= 98; Stmt_S2[i0, 0] -> Stmt_S1[1 + i0, 0] : 0 <= i0 <= 97 }
7 ; CHECK-NEXT: WAW dependences:
8 ; CHECK-NEXT: { Stmt_S1[i0, 0] -> Stmt_S2[i0, 0] : 0 <= i0 <= 98; Stmt_S2[i0, 0] -> Stmt_S1[1 + i0, 0] : 0 <= i0 <= 97 }
9 ; CHECK-NEXT: Reduction dependences:
10 ; CHECK-NEXT: { Stmt_S2[i0, i1] -> Stmt_S2[1 + i0, i1] : 0 <= i0 <= 97 and 0 < i1 <= 99 }
13 ; for (int i = 0; i < 99; i++) {
14 ; for (int j = 0; j < 1; j++)
16 ; for (int j = 0; j < 100; j++)
17 ; S2: sum[j] += i * j;
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.inc12, %entry
28 %i.0 = phi i32 [ 0, %entry ], [ %inc13, %for.inc12 ]
29 %exitcond2 = icmp ne i32 %i.0, 99
30 br i1 %exitcond2, label %for.body, label %for.end14
32 for.body: ; preds = %for.cond
35 for.cond1: ; preds = %for.inc, %for.body
36 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
37 %exitcond = icmp ne i32 %j.0, 1
38 br i1 %exitcond, label %for.body3, label %for.end
40 for.body3: ; preds = %for.cond1
43 S1: ; preds = %for.body3
44 %arrayidx = getelementptr inbounds i32, ptr %sum, i32 %j.0
45 %tmp = load i32, ptr %arrayidx, align 4
46 %add = add nsw i32 %tmp, 42
47 store i32 %add, ptr %arrayidx, align 4
50 for.inc: ; preds = %S1
51 %inc = add nsw i32 %j.0, 1
54 for.end: ; preds = %for.cond1
57 for.cond4: ; preds = %for.inc9, %for.end
58 %j.1 = phi i32 [ 0, %for.end ], [ %inc10, %for.inc9 ]
59 %exitcond1 = icmp ne i32 %j.1, 100
60 br i1 %exitcond1, label %for.body6, label %for.end11
62 for.body6: ; preds = %for.cond4
65 S2: ; preds = %for.body6
66 %mul = mul nsw i32 %i.0, %j.1
67 %arrayidx7 = getelementptr inbounds i32, ptr %sum, i32 %j.1
68 %tmp3 = load i32, ptr %arrayidx7, align 4
69 %add8 = add nsw i32 %tmp3, %mul
70 store i32 %add8, ptr %arrayidx7, align 4
73 for.inc9: ; preds = %S2
74 %inc10 = add nsw i32 %j.1, 1
77 for.end11: ; preds = %for.cond4
80 for.inc12: ; preds = %for.end11
81 %inc13 = add nsw i32 %i.0, 1
84 for.end14: ; preds = %for.cond