1 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-flatten-schedule -polly-delicm-overapproximate-writes=true -polly-delicm-compute-known=true -polly-print-delicm -disable-output < %s | FileCheck %s
3 ; void func(int *A, double* StartPtr) {
4 ; for (int j = 0; j < 2; j += 1) { /* outer */
6 ; for (int i = 0; i < 4; i += 1) /* reduction */
12 define void @func(ptr noalias nonnull %A, ptr noalias nonnull %StartPtr) {
14 br label %outer.preheader
20 %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
21 %j.cmp = icmp slt i32 %j, 2
22 br i1 %j.cmp, label %reduction.preheader, label %outer.exit
26 %Start = load double, ptr %StartPtr
27 br label %reduction.for
30 %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
31 %phi = phi double [%Start, %reduction.preheader], [%add, %reduction.inc]
37 %add = fadd double %phi, 4.2
38 br label %reduction.inc
43 %i.inc = add nuw nsw i32 %i, 1
44 %i.cmp = icmp slt i32 %i.inc, 4
45 br i1 %i.cmp, label %reduction.for, label %reduction.exit
48 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
49 store double %add, ptr %A_idx
55 %j.inc = add nuw nsw i32 %j, 1
65 ; CHECK: After accesses {
66 ; CHECK-NEXT: Stmt_reduction_preheader
67 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
68 ; CHECK-NEXT: { Stmt_reduction_preheader[i0] -> MemRef_StartPtr[0] };
69 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
70 ; CHECK-NEXT: { Stmt_reduction_preheader[i0] -> MemRef_phi__phi[] };
71 ; CHECK-NEXT: new: { Stmt_reduction_preheader[i0] -> MemRef_A[i0] };
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] : 3i1 <= 22 - 14i0; Stmt_body[1, 3] -> MemRef_A[1] };
86 ; CHECK-NEXT: Stmt_reduction_inc
87 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
88 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };
89 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : 3i1 <= 22 - 14i0; Stmt_reduction_inc[1, 3] -> MemRef_A[1] };
90 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
91 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };
92 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] };
93 ; CHECK-NEXT: Stmt_reduction_exit
94 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
95 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };
96 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
97 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_add[] };
98 ; CHECK-NEXT: new: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };