1 ; RUN: opt %loadPolly -polly-flatten-schedule -polly-delicm-overapproximate-writes=true -polly-delicm-compute-known=true -polly-delicm -analyze < %s | FileCheck %s
4 ; for (int j = 0; j < 2; j += 1) { /* outer */
6 ; for (int i = 0; i < 4; i += 1) /* reduction */
12 define void @func(i32* noalias nonnull %A) {
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 br label %reduction.for
29 %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
30 %phi = phi i32 [%j, %reduction.preheader], [%mul, %reduction.inc]
36 %mul = mul i32 %phi, 42
37 br label %reduction.inc
42 %i.inc = add nuw nsw i32 %i, 1
43 %i.cmp = icmp slt i32 %i.inc, 4
44 br i1 %i.cmp, label %reduction.for, label %reduction.exit
47 %A_idx = getelementptr inbounds i32, i32* %A, i32 %j
48 store i32 %mul, i32* %A_idx
54 %j.inc = add nuw nsw i32 %j, 1
65 ; CHECK: After accesses {
66 ; CHECK-NEXT: Stmt_reduction_preheader
67 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
68 ; CHECK-NEXT: { Stmt_reduction_preheader[i0] -> MemRef_phi__phi[] };
69 ; CHECK-NEXT: new: { Stmt_reduction_preheader[i0] -> MemRef_A[i0] : 0 <= i0 <= 1 };
70 ; CHECK-NEXT: Stmt_reduction_for
71 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
72 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };
73 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] : 0 <= i0 <= 1 and 0 <= i1 <= 3 };
74 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
75 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };
76 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] : 0 <= i0 <= 1 and 0 <= i1 <= 3 };
77 ; CHECK-NEXT: Stmt_body
78 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
79 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_mul[] };
80 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] : 0 <= i0 <= 1 and 0 <= i1 <= 3 };
81 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
82 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_phi[] };
83 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] : 0 <= i1 <= 3 and -14i0 <= 3i1 <= 22 - 14i0; Stmt_body[1, 3] -> MemRef_A[1] };
84 ; CHECK-NEXT: Stmt_reduction_inc
85 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
86 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_mul[] };
87 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : 0 <= i1 <= 3 and -14i0 <= 3i1 <= 22 - 14i0; Stmt_reduction_inc[1, 3] -> MemRef_A[1] };
88 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
89 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };
90 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : 0 <= i0 <= 1 and 0 <= i1 <= 3 };
91 ; CHECK-NEXT: Stmt_reduction_exit
92 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
93 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };
94 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
95 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_mul[] };
96 ; CHECK-NEXT: new: { Stmt_reduction_exit[i0] -> MemRef_A[i0] : 0 <= i0 <= 1 };