1 ; RUN: opt %loadPolly -polly-flatten-schedule -polly-delicm-compute-known=true -polly-print-delicm -disable-output < %s | FileCheck %s
3 ; void func(double *A) {
4 ; for (int j = 0; j < 2; j += 1) { /* outer */
6 ; for (int i = 0; i < 4; i += 1) { /* reduction */
14 define void @func(ptr noalias nonnull %A) {
16 br label %outer.preheader
22 %j = phi i32 [0, %outer.preheader], [%j.inc, %outer.inc]
23 %j.cmp = icmp slt i32 %j, 2
24 br i1 %j.cmp, label %reduction.preheader, label %outer.exit
28 br label %reduction.for
31 %i = phi i32 [0, %reduction.preheader], [%i.inc, %reduction.inc]
32 %phi = phi double [0.0, %reduction.preheader], [%add, %reduction.inc]
33 %i.cmp = icmp slt i32 %i, 4
34 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
35 br i1 %i.cmp, label %body, label %reduction.exit
40 %add = fadd double %phi, 4.2
41 store double %add, ptr %A_idx
42 br label %reduction.inc
47 %i.inc = add nuw nsw i32 %i, 1
48 br label %reduction.for
51 store double %phi, ptr %A_idx
57 %j.inc = add nuw nsw i32 %j, 1
68 ; CHECK: After accesses {
69 ; CHECK-NEXT: Stmt_reduction_preheader
70 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
71 ; CHECK-NEXT: { Stmt_reduction_preheader[i0] -> MemRef_phi__phi[] };
72 ; CHECK-NEXT: new: { Stmt_reduction_preheader[i0] -> MemRef_A[i0] };
73 ; CHECK-NEXT: Stmt_reduction_for
74 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
75 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };
76 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };
77 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
78 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };
79 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };
80 ; CHECK-NEXT: Stmt_body
81 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
82 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_add[] };
83 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] };
84 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
85 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_phi[] };
86 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] };
87 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
88 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_A[i0] };
89 ; CHECK-NEXT: Stmt_reduction_inc
90 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
91 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };
92 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : i1 <= 7 - 5i0; Stmt_reduction_inc[1, 3] -> MemRef_A[1] };
93 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
94 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };
95 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] };
96 ; CHECK-NEXT: Stmt_reduction_exit
97 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
98 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };
99 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
100 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_phi[] };
101 ; CHECK-NEXT: new: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };