1 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-print-delicm -disable-output < %s | FileCheck %s -match-full-lines
3 ; Hosted reduction load (but not the store) 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 */
15 define void @func(ptr noalias nonnull %A) {
17 br label %outer.preheader
23 %j = phi i32 [0, %outer.preheader], [%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]
36 %add = fadd double %phi, 4.2
37 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
38 store double %add, ptr %A_idx
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
54 %j.inc = add nuw nsw i32 %j, 1
66 ; CHECK: Compatible overwrites: 1
67 ; CHECK: Overwrites mapped to: 1
68 ; CHECK: Value scalars mapped: 2
69 ; CHECK: PHI scalars mapped: 1
72 ; CHECK-NEXT: After accesses {
73 ; CHECK-NEXT: Stmt_outer_for
74 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
75 ; CHECK-NEXT: { Stmt_outer_for[i0] -> MemRef_phi__phi[] };
76 ; CHECK-NEXT: new: { Stmt_outer_for[i0] -> MemRef_A[i0] : i0 <= 1 };
77 ; CHECK-NEXT: Stmt_reduction_for
78 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
79 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };
80 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };
81 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
82 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };
83 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[i0] };
84 ; CHECK-NEXT: Stmt_body
85 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
86 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_add[] };
87 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] };
88 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
89 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_phi[] };
90 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[i0] };
91 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
92 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_A[i0] };
93 ; CHECK-NEXT: Stmt_reduction_inc
94 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
95 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };
96 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] };
97 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
98 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };
99 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] : i1 <= 2 };