1 ; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb -polly-delicm-partial-writes=true '-passes=print<polly-delicm>' -disable-output < %s | FileCheck -match-full-lines %s
3 ; Map %add and %phi to A[j].
4 ; The non-analyzable store to C[0] is unrelated and can be ignored.
6 ; void func(double *A) {
7 ; for (int j = 0; j < 2; j += 1) { /* outer */
9 ; for (int i = 0; i < 4; i += 1) { /* reduction */
18 define void @func(ptr noalias nonnull %A, ptr noalias nonnull %C) {
23 %j = phi i32 [0, %entry], [%j.inc, %outer.inc]
24 %j.cmp = icmp slt i32 %j, 2
25 br i1 %j.cmp, label %reduction.for, label %outer.exit
29 %i = phi i32 [0, %outer.for], [%i.inc, %reduction.inc]
30 %phi = phi double [0.0, %outer.for], [%add, %reduction.inc]
31 %i.cmp = icmp slt i32 %i, 4
32 br i1 %i.cmp, label %body, label %reduction.exit
37 %add = fadd double %phi, 4.2
38 store double 21.0, ptr %C
39 store double 41.0, ptr %C
40 br label %reduction.inc
45 %i.inc = add nuw nsw i32 %i, 1
46 br label %reduction.for
49 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
50 store double %phi, ptr %A_idx
56 %j.inc = add nuw nsw i32 %j, 1
67 ; CHECK: After accesses {
68 ; CHECK-NEXT: Stmt_outer_for
69 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
70 ; CHECK-NEXT: { Stmt_outer_for[i0] -> MemRef_phi__phi[] };
71 ; CHECK-NEXT: new: { Stmt_outer_for[i0] -> MemRef_A[i0] : i0 <= 1 };
72 ; CHECK-NEXT: Stmt_reduction_for
73 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
74 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };
75 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };
76 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
77 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };
78 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };
79 ; CHECK-NEXT: Stmt_body
80 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
81 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_add[] };
82 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] };
83 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
84 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_phi[] };
85 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] };
86 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
87 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_C[0] };
88 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
89 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_C[0] };
90 ; CHECK-NEXT: Stmt_reduction_inc
91 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
92 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };
93 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] };
94 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
95 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };
96 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] };
97 ; CHECK-NEXT: Stmt_reduction_exit
98 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
99 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };
100 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
101 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_phi[] };
102 ; CHECK-NEXT: new: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };