1 ; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa '-passes=print<polly-dependences>' -disable-output < %s | FileCheck %s
4 ; These are the important RAW dependences, as they need to originate/end in only one iteration:
5 ; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1]
6 ; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0]
8 ; These are the important WAW dependences, as they need to originate/end in only one iteration:
9 ; Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1]
10 ; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0]
12 ; CHECK: RAW dependences:
13 ; CHECK-NEXT: { Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023 }
14 ; CHECK-NEXT: WAR dependences:
15 ; CHECK-NEXT: { Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023 }
16 ; CHECK-NEXT: WAW dependences:
17 ; CHECK-NEXT: { Stmt_S1[i0, 1023] -> Stmt_S2[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023; Stmt_S1[i0, i1] -> Stmt_S2[i0, 0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S3[i0] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023; Stmt_S3[i0] -> Stmt_S0[1 + i0] : 0 <= i0 <= 1022; Stmt_S0[i0] -> Stmt_S1[i0, o1] : 0 <= i0 <= 1023 and 0 <= o1 <= 1023 }
18 ; CHECK-NEXT: Reduction dependences:
19 ; CHECK-NEXT: { Stmt_S1[i0, i1] -> Stmt_S1[i0, 1 + i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022; Stmt_S2[i0, i1] -> Stmt_S2[i0, 1 + i1] : 0 <= i0 <= 1023 and 0 <= i1 <= 1022 }
21 ; void f(int *restrict red) {
22 ; for (int j = 0; j < 1024; j++) {
23 ; S0: *red = 42 + *red * 5;
24 ; for (int i = 0; i < 1024; i++)
26 ; for (int i = 0; i < 1024; i++)
28 ; S3: *red = 42 + *red * 7;
32 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
34 define void @f(ptr noalias %red) {
38 for.cond: ; preds = %for.inc15, %entry
39 %j.0 = phi i32 [ 0, %entry ], [ %inc16, %for.inc15 ]
40 %exitcond2 = icmp ne i32 %j.0, 1024
41 br i1 %exitcond2, label %for.body, label %for.end17
43 for.body: ; preds = %for.cond
46 S0: ; preds = %for.body
47 %tmp = load i32, ptr %red, align 4
48 %mul = mul nsw i32 %tmp, 5
49 %add = add nsw i32 %mul, 42
50 store i32 %add, ptr %red, align 4
53 for.cond1: ; preds = %for.inc, %S0
54 %i.0 = phi i32 [ 0, %S0 ], [ %inc, %for.inc ]
55 %exitcond = icmp ne i32 %i.0, 1024
56 br i1 %exitcond, label %for.body3, label %for.end
58 for.body3: ; preds = %for.cond1
61 S1: ; preds = %for.body3
62 %tmp3 = load i32, ptr %red, align 4
63 %mul4 = mul nsw i32 %tmp3, %i.0
64 store i32 %mul4, ptr %red, align 4
67 for.inc: ; preds = %S1
68 %inc = add nsw i32 %i.0, 1
71 for.end: ; preds = %for.cond1
74 for.cond6: ; preds = %for.inc10, %for.end
75 %i5.0 = phi i32 [ 0, %for.end ], [ %inc11, %for.inc10 ]
76 %exitcond1 = icmp ne i32 %i5.0, 1024
77 br i1 %exitcond1, label %for.body8, label %for.end12
79 for.body8: ; preds = %for.cond6
82 S2: ; preds = %for.body8
83 %tmp4 = load i32, ptr %red, align 4
84 %add9 = add nsw i32 %tmp4, %i5.0
85 store i32 %add9, ptr %red, align 4
88 for.inc10: ; preds = %S2
89 %inc11 = add nsw i32 %i5.0, 1
92 for.end12: ; preds = %for.cond6
95 S3: ; preds = %for.end12
96 %tmp5 = load i32, ptr %red, align 4
97 %mul13 = mul nsw i32 %tmp5, 7
98 %add14 = add nsw i32 %mul13, 42
99 store i32 %add14, ptr %red, align 4
102 for.inc15: ; preds = %S3
103 %inc16 = add nsw i32 %j.0, 1
106 for.end17: ; preds = %for.cond