1 ; RUN: opt -S %loadNPMPolly '-passes=print<polly-dependences>' -disable-output < %s | FileCheck %s -check-prefix=VALUE
2 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4 ; for (int i = 0; i < N; i++) {
5 ; A.must.write.20: A[i] = 20;
7 ; compute.i.square: if (i * i)
8 ; A.may.write.90: A[i] = 90;
10 ; B.write.from.A: B[i] = A[i];
11 ; A.must.write.42: A[i] = 42;
13 define void @f(ptr %A, ptr %B) {
17 for.cond: ; preds = %for.inc, %entry
18 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
19 %exitcond = icmp ne i64 %indvars.iv, 3000
20 br i1 %exitcond, label %A.must.write.20, label %for.end
23 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
24 store i32 20, ptr %arrayidx, align 4
25 br label %compute.i.square
28 %tmp = mul nsw i64 %indvars.iv, %indvars.iv
29 %tmp2 = trunc i64 %tmp to i32
30 %tobool = icmp eq i32 %tmp2, 0
31 br i1 %tobool, label %B.write.from.A, label %A.may.write.90
34 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
35 store i32 90, ptr %arrayidx2, align 4
36 br label %B.write.from.A
39 %arrayidx4 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
40 %tmp3 = load i32, ptr %arrayidx4, align 4
41 %arrayidx6 = getelementptr inbounds i32, ptr %B, i64 %indvars.iv
42 store i32 %tmp3, ptr %arrayidx6, align 4
43 br label %A.must.write.42
47 %arrayidx5 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
48 store i32 42, ptr %arrayidx5, align 4
51 for.inc: ; preds = %if.end
52 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
55 for.end: ; preds = %for.cond
58 ; VALUE: RAW dependences:
59 ; VALUE-NEXT: { Stmt_compute_i_square__TO__B_write_from_A[i0] -> Stmt_B_write_from_A[i0] : 0 <= i0 <= 2999; Stmt_A_must_write_20[i0] -> Stmt_B_write_from_A[i0] : 0 <= i0 <= 2999 }
60 ; VALUE-NEXT: WAR dependences:
61 ; VALUE-NEXT: { Stmt_B_write_from_A[i0] -> Stmt_A_must_write_42[i0] : 0 <= i0 <= 2999 }
62 ; VALUE-NEXT: WAW dependences:
63 ; VALUE-NEXT: { Stmt_A_must_write_20[i0] -> Stmt_compute_i_square__TO__B_write_from_A[i0] : 0 <= i0 <= 2999; Stmt_compute_i_square__TO__B_write_from_A[i0] -> Stmt_A_must_write_42[i0] : 0 <= i0 <= 2999; Stmt_A_must_write_20[i0] -> Stmt_A_must_write_42[i0] : 0 <= i0 <= 2999 }
64 ; VALUE-NEXT: Reduction dependences:
66 ; VALUE-NEXT: Transitive closure of reduction dependences: