1 ; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=print<polly-delicm>' -disable-output < %s | FileCheck %s
3 ; Register-promoted reduction but without preheader.
5 ; void func(double *A) {
6 ; for (int j = 0; j < 2; j += 1) { /* outer */
8 ; 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 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
25 %init = load double, ptr %A_idx
26 br i1 %j.cmp, label %reduction.for, label %outer.exit
31 %i = phi i32 [0, %outer.for], [%i.inc, %reduction.inc]
32 %phi = phi double [%init, %outer.for], [%add, %reduction.inc]
38 %add = fadd double %phi, 4.2
39 br label %reduction.inc
44 %i.inc = add nuw nsw i32 %i, 1
45 %i.cmp = icmp slt i32 %i.inc, 4
46 br i1 %i.cmp, label %reduction.for, label %reduction.exit
49 store double %add, ptr %A_idx
55 %j.inc = add nuw nsw i32 %j, 1
67 ; CHECK: Compatible overwrites: 1
68 ; CHECK: Overwrites mapped to: 1
69 ; CHECK: Value scalars mapped: 2
70 ; CHECK: PHI scalars mapped: 1
73 ; CHECK: After accesses {
74 ; CHECK-NEXT: Stmt_outer_for
75 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
76 ; CHECK-NEXT: { Stmt_outer_for[i0] -> MemRef_A[i0] };
77 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
78 ; CHECK-NEXT: { Stmt_outer_for[i0] -> MemRef_phi__phi[] };
79 ; CHECK-NEXT: new: { Stmt_outer_for[i0] -> MemRef_A[i0] : i0 <= 1 };
80 ; CHECK-NEXT: Stmt_reduction_for
81 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
82 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };
83 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };
84 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
85 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };
86 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };
87 ; CHECK-NEXT: Stmt_body
88 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
89 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_add[] };
90 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] };
91 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
92 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_phi[] };
93 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] };
94 ; CHECK-NEXT: Stmt_reduction_inc
95 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
96 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };
97 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] };
98 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
99 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };
100 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : i1 <= 2 };
101 ; CHECK-NEXT: Stmt_reduction_exit
102 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
103 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };
104 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
105 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_add[] };
106 ; CHECK-NEXT: new: { Stmt_reduction_exit[i0] -> MemRef_A[i0] };