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