1 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-import-jscop-postfix=transformed -polly-print-import-jscop -disable-output < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-import-jscop-postfix=transformed -polly-import-jscop -polly-codegen -S < %s | FileCheck %s --check-prefix=CODEGEN
4 define void @map_scalar_access(ptr noalias nonnull %A) {
9 %j = phi i32 [0, %entry], [%j.inc, %outer.inc]
10 %j.cmp = icmp slt i32 %j, 1
11 br i1 %j.cmp, label %reduction.for, label %outer.exit
15 %i = phi i32 [0, %outer.for], [%i.inc, %reduction.inc]
16 %phi = phi double [0.0, %outer.for], [%add, %reduction.inc]
17 %i.cmp = icmp slt i32 %i, 4
18 br i1 %i.cmp, label %body, label %reduction.exit
21 %add = fadd double %phi, 4.2
22 br label %reduction.inc
25 %i.inc = add nuw nsw i32 %i, 1
26 br label %reduction.for
29 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
30 store double %phi, ptr %A_idx
35 %j.inc = add nuw nsw i32 %j, 1
48 ; CHECK-NEXT: double MemRef_phi__phi; // Element size 8
49 ; CHECK-NEXT: double MemRef_phi; // Element size 8
50 ; CHECK-NEXT: double MemRef_add; // Element size 8
51 ; CHECK-NEXT: double MemRef_A[*]; // Element size 8
54 ; CHECK-NEXT: Stmt_outer_for
55 ; CHECK-NEXT: Domain :=
56 ; CHECK-NEXT: { Stmt_outer_for[i0] : 0 <= i0 <= 1 };
57 ; CHECK-NEXT: Schedule :=
58 ; CHECK-NEXT: { Stmt_outer_for[i0] -> [i0, 0, 0, 0] };
59 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
60 ; CHECK-NEXT: { Stmt_outer_for[i0] -> MemRef_phi__phi[] };
61 ; CHECK-NEXT: new: { Stmt_outer_for[i0] -> MemRef_A[i0] };
62 ; CHECK-NEXT: Stmt_reduction_for
63 ; CHECK-NEXT: Domain :=
64 ; CHECK-NEXT: { Stmt_reduction_for[0, i1] : 0 <= i1 <= 4 };
65 ; CHECK-NEXT: Schedule :=
66 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> [0, 1, i1, 0] };
67 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
68 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi__phi[] };
69 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[0] };
70 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
71 ; CHECK-NEXT: { Stmt_reduction_for[i0, i1] -> MemRef_phi[] };
72 ; CHECK-NEXT: new: { Stmt_reduction_for[i0, i1] -> MemRef_A[0] };
73 ; CHECK-NEXT: Stmt_body
74 ; CHECK-NEXT: Domain :=
75 ; CHECK-NEXT: { Stmt_body[0, i1] : 0 <= i1 <= 3 };
76 ; CHECK-NEXT: Schedule :=
77 ; CHECK-NEXT: { Stmt_body[i0, i1] -> [0, 1, i1, 1] };
78 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
79 ; CHECK-NEXT: { Stmt_body[i0, i1] -> MemRef_add[] };
80 ; CHECK-NEXT: new: { Stmt_body[i0, i1] -> MemRef_A[0] };
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[0] };
84 ; CHECK-NEXT: Stmt_reduction_inc
85 ; CHECK-NEXT: Domain :=
86 ; CHECK-NEXT: { Stmt_reduction_inc[0, i1] : 0 <= i1 <= 3 };
87 ; CHECK-NEXT: Schedule :=
88 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> [0, 1, i1, 2] };
89 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
90 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_add[] };
91 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[0] };
92 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
93 ; CHECK-NEXT: { Stmt_reduction_inc[i0, i1] -> MemRef_phi__phi[] };
94 ; CHECK-NEXT: new: { Stmt_reduction_inc[i0, i1] -> MemRef_A[0] };
95 ; CHECK-NEXT: Stmt_reduction_exit
96 ; CHECK-NEXT: Domain :=
97 ; CHECK-NEXT: { Stmt_reduction_exit[0] };
98 ; CHECK-NEXT: Schedule :=
99 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> [0, 2, 0, 0] };
100 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
101 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_A[0] };
102 ; CHECK-NEXT: new: { Stmt_reduction_exit[i0] -> MemRef_A[0] };
103 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
104 ; CHECK-NEXT: { Stmt_reduction_exit[i0] -> MemRef_phi[] };
105 ; CHECK-NEXT: new: { Stmt_reduction_exit[i0] -> MemRef_A[0] };
107 ; CHECK: New access function '{ Stmt_outer_for[i0] -> MemRef_A[i0] }' detected in JSCOP file
108 ; CHECK-NEXT: New access function '{ Stmt_reduction_for[i0, i1] -> MemRef_A[i0] }' detected in JSCOP file
109 ; CHECK-NEXT: New access function '{ Stmt_reduction_for[i0, i1] -> MemRef_A[i0] }' detected in JSCOP file
110 ; CHECK-NEXT: New access function '{ Stmt_body[i0, i1] -> MemRef_A[i0] }' detected in JSCOP file
111 ; CHECK-NEXT: New access function '{ Stmt_body[i0, i1] -> MemRef_A[i0] }' detected in JSCOP file
112 ; CHECK-NEXT: New access function '{ Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] }' detected in JSCOP file
113 ; CHECK-NEXT: New access function '{ Stmt_reduction_inc[i0, i1] -> MemRef_A[i0] }' detected in JSCOP file
114 ; CHECK-NEXT: New access function '{ Stmt_reduction_exit[i0] -> MemRef_A[i0] }' detected in JSCOP file
115 ; CHECK-NEXT: New access function '{ Stmt_reduction_exit[i0] -> MemRef_A[i0] }' detected in JSCOP file
117 ; CODEGEN: polly.stmt.outer.for:
118 ; CODEGEN-NEXT: %polly.access.A[[R0:[0-9]*]] = getelementptr double, ptr %A, i64 %polly.indvar
119 ; CODEGEN-NEXT: store double 0.000000e+00, ptr %polly.access.A[[R0]]
120 ; CODEGEN-NEXT: br label %polly.cond
122 ; CODEGEN: polly.stmt.reduction.exit:
123 ; CODEGEN-NEXT: %polly.access.A[[R1:[0-9]*]] = getelementptr double, ptr %A, i64 0
124 ; CODEGEN-NEXT: %polly.access.A[[R1]].reload = load double, ptr %polly.access.A[[R1]]
125 ; CODEGEN-NEXT: %polly.access.A[[R2:[0-9]*]] = getelementptr double, ptr %A, i64 0
126 ; CODEGEN-NEXT: store double %polly.access.A[[R1]].reload, ptr %polly.access.A[[R2]]
127 ; CODEGEN-NEXT: br label %polly.merge
129 ; CODEGEN: polly.stmt.reduction.for:
130 ; CODEGEN-NEXT: %polly.access.A[[R3:[0-9]*]] = getelementptr double, ptr %A, i64 0
131 ; CODEGEN-NEXT: %polly.access.A[[R3]].reload = load double, ptr %polly.access.A[[R3]]
132 ; CODEGEN-NEXT: %polly.access.A[[R4:[0-9]*]] = getelementptr double, ptr %A, i64 0
133 ; CODEGEN-NEXT: store double %polly.access.A[[R3]].reload, ptr %polly.access.A[[R4]]
134 ; CODEGEN-NEXT: br label %polly.cond9
136 ; CODEGEN: polly.stmt.body:
137 ; CODEGEN-NEXT: %polly.access.A[[R5:[0-9]*]] = getelementptr double, ptr %A, i64 0
138 ; CODEGEN-NEXT: %polly.access.A[[R5]].reload = load double, ptr %polly.access.A[[R5]]
139 ; CODEGEN-NEXT: %p_add = fadd double %polly.access.A13.reload, 4.200000e+00
140 ; CODEGEN-NEXT: %polly.access.A[[R6:[0-9]*]] = getelementptr double, ptr %A, i64 0
141 ; CODEGEN-NEXT: store double %p_add, ptr %polly.access.A[[R6]]
142 ; CODEGEN-NEXT: br label %polly.stmt.reduction.inc
144 ; CODEGEN: polly.stmt.reduction.inc:
145 ; CODEGEN-NEXT: %polly.access.A[[R7:[0-9]*]] = getelementptr double, ptr %A, i64 0
146 ; CODEGEN-NEXT: %polly.access.A[[R7]].reload = load double, ptr %polly.access.A[[R7]]
147 ; CODEGEN-NEXT: %polly.access.A[[R8:[0-9]*]] = getelementptr double, ptr %A, i64 0
148 ; CODEGEN-NEXT: store double %polly.access.A[[R7]].reload, ptr %polly.access.A[[R8]]
149 ; CODEGEN-NEXT: br label %polly.merge10