@@ -109,3 +109,48 @@ void func2(void) {
109
109
void func3 (void ) {
110
110
float a [16 ][1 ] = {{0. }};
111
111
}
112
+
113
+ // CL12-LABEL: define dso_local void @wrong_store_type_private_pointer_alloca(
114
+ // CL12-SAME: ) #[[ATTR0]] {
115
+ // CL12-NEXT: [[ENTRY:.*:]]
116
+ // CL12-NEXT: [[PLONG:%.*]] = alloca i64, align 8, addrspace(5)
117
+ // CL12-NEXT: [[PLONGP:%.*]] = alloca ptr addrspace(5), align 4, addrspace(5)
118
+ // CL12-NEXT: [[GLONGP:%.*]] = alloca ptr addrspace(5), align 4, addrspace(5)
119
+ // CL12-NEXT: store i64 5, ptr addrspace(5) [[PLONG]], align 8
120
+ // CL12-NEXT: store ptr addrspace(5) [[PLONG]], ptr addrspace(5) [[PLONGP]], align 4
121
+ // CL12-NEXT: [[TMP0:%.*]] = load ptr addrspace(5), ptr addrspace(5) [[PLONGP]], align 4
122
+ // CL12-NEXT: store i64 8, ptr addrspace(5) [[TMP0]], align 8
123
+ // CL12-NEXT: store ptr addrspace(5) [[PLONG]], ptr addrspace(5) [[GLONGP]], align 4
124
+ // CL12-NEXT: [[TMP1:%.*]] = load ptr addrspace(5), ptr addrspace(5) [[GLONGP]], align 4
125
+ // CL12-NEXT: store i64 9, ptr addrspace(5) [[TMP1]], align 8
126
+ // CL12-NEXT: ret void
127
+ //
128
+ // CL20-LABEL: define dso_local void @wrong_store_type_private_pointer_alloca(
129
+ // CL20-SAME: ) #[[ATTR0]] {
130
+ // CL20-NEXT: [[ENTRY:.*:]]
131
+ // CL20-NEXT: [[PLONG:%.*]] = alloca i64, align 8, addrspace(5)
132
+ // CL20-NEXT: [[PLONGP:%.*]] = alloca ptr addrspace(5), align 4, addrspace(5)
133
+ // CL20-NEXT: [[GLONGP:%.*]] = alloca ptr, align 8, addrspace(5)
134
+ // CL20-NEXT: [[PLONG_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[PLONG]] to ptr
135
+ // CL20-NEXT: [[PLONGP_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[PLONGP]] to ptr
136
+ // CL20-NEXT: [[GLONGP_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[GLONGP]] to ptr
137
+ // CL20-NEXT: store i64 5, ptr [[PLONG_ASCAST]], align 8
138
+ // CL20-NEXT: store ptr [[PLONG_ASCAST]], ptr [[PLONGP_ASCAST]], align 4
139
+ // CL20-NEXT: [[TMP0:%.*]] = load ptr addrspace(5), ptr [[PLONGP_ASCAST]], align 4
140
+ // CL20-NEXT: store i64 8, ptr addrspace(5) [[TMP0]], align 8
141
+ // CL20-NEXT: store ptr [[PLONG_ASCAST]], ptr [[GLONGP_ASCAST]], align 8
142
+ // CL20-NEXT: [[TMP1:%.*]] = load ptr, ptr [[GLONGP_ASCAST]], align 8
143
+ // CL20-NEXT: store i64 9, ptr [[TMP1]], align 8
144
+ // CL20-NEXT: ret void
145
+ //
146
+ void wrong_store_type_private_pointer_alloca () {
147
+ long plong = 5 ;
148
+
149
+ // This needs to write an addrspace(5) pointer to the temporary alloca
150
+ __private long * plongp = & plong ;
151
+ * plongp = 8 ;
152
+
153
+ // This needs to write an addrspace(0) pointer to the temporary alloca in CL2.0
154
+ long * glongp = & plong ;
155
+ * glongp = 9 ;
156
+ }
0 commit comments