98
98
; return 0;
99
99
;}
100
100
101
- %struct.Foo = type { i32 addrspace (1 )*, i32* , i8* }
102
- declare dso_local void @use_foo (%struct.Foo* )
101
+ %struct.Foo = type { ptr addrspace (1 ), ptr , ptr }
102
+ declare void @use_foo (ptr )
103
103
104
- define void @ptr32_to_ptr (%struct.Foo* %f , i32 addrspace (1 )* %i ) {
104
+ define void @ptr32_to_ptr (ptr %f , ptr addrspace (1 ) %i ) {
105
+ entry:
105
106
; CHECK-LABEL: ptr32_to_ptr:
106
107
; CHECK: llgtr 0, 2
107
108
; CHECK-NEXT: stg 0, 8(1)
108
- entry:
109
- %0 = addrspacecast i32 addrspace (1 )* %i to i32*
110
- %p64 = getelementptr inbounds %struct.Foo , %struct.Foo* %f , i64 0 , i32 1
111
- store i32* %0 , i32** %p64 , align 8
112
- tail call void @use_foo (%struct.Foo* %f )
109
+ %0 = addrspacecast ptr addrspace (1 ) %i to ptr
110
+ %p64 = getelementptr inbounds %struct.Foo , ptr %f , i64 0 , i32 1
111
+ store ptr %0 , ptr %p64 , align 8
112
+ tail call void @use_foo (ptr %f )
113
113
ret void
114
114
}
115
115
116
- define void @ptr_to_ptr32 (%struct.Foo* %f , i32* %i ) {
116
+ define void @ptr_to_ptr32 (ptr %f , ptr %i ) {
117
117
entry:
118
118
; CHECK-LABEL: ptr_to_ptr32:
119
119
; CHECK: nilh 2, 32767
120
120
; CHECK-NEXT: st 2, 0(1)
121
- %0 = addrspacecast i32* %i to i32 addrspace (1 )*
122
- %p32 = getelementptr inbounds %struct.Foo , %struct.Foo* %f , i64 0 , i32 0
123
- store i32 addrspace (1 )* %0 , i32 addrspace ( 1 )** %p32 , align 8
124
- tail call void @use_foo (%struct.Foo* %f )
121
+ %0 = addrspacecast ptr %i to ptr addrspace (1 )
122
+ %p32 = getelementptr inbounds %struct.Foo , ptr %f , i64 0 , i32 0
123
+ store ptr addrspace (1 ) %0 , ptr %p32 , align 8
124
+ tail call void @use_foo (ptr %f )
125
125
ret void
126
126
}
127
127
128
- define void @ptr32_to_ptr32 (%struct.Foo* %f , i32 addrspace (1 )* %i ) {
128
+ define void @ptr32_to_ptr32 (ptr %f , ptr addrspace (1 ) %i ) {
129
129
entry:
130
130
; CHECK-LABEL: ptr32_to_ptr32:
131
131
; CHECK: st 2, 0(1)
132
- %p32 = getelementptr inbounds %struct.Foo , %struct.Foo* %f , i64 0 , i32 0
133
- store i32 addrspace (1 )* %i , i32 addrspace ( 1 )** %p32 , align 8
134
- tail call void @use_foo (%struct.Foo* %f )
132
+ %p32 = getelementptr inbounds %struct.Foo , ptr %f , i64 0 , i32 0
133
+ store ptr addrspace (1 ) %i , ptr %p32 , align 8
134
+ tail call void @use_foo (ptr %f )
135
135
ret void
136
136
}
137
137
138
- define void @ptr_to_ptr (%struct.Foo* %f , i32* %i ) {
138
+ define void @ptr_to_ptr (ptr %f , ptr %i ) {
139
139
; CHECK-LABEL: ptr_to_ptr:
140
140
; CHECK: stg 2, 8(1)
141
- %p64 = getelementptr inbounds %struct.Foo , %struct.Foo* %f , i64 0 , i32 1
142
- store i32* %i , i32** %p64 , align 8
143
- tail call void @use_foo (%struct.Foo* %f )
141
+ %p64 = getelementptr inbounds %struct.Foo , ptr %f , i64 0 , i32 1
142
+ store ptr %i , ptr %p64 , align 8
143
+ tail call void @use_foo (ptr %f )
144
144
ret void
145
145
}
146
146
147
- define void @test_indexing (%struct.Foo* %f ) {
147
+ define void @test_indexing (ptr %f ) {
148
148
entry:
149
149
; CHECK-LABEL: test_indexing:
150
150
; CHECK: l 0, 1032
151
151
; CHECK: llgtr 0, 0
152
152
; CHECK: stg 0, 16(1)
153
- %0 = load i8 addrspace (1 )*, i8 addrspace ( 1 )** inttoptr (i64 1032 to i8 addrspace ( 1 )** ), align 8
154
- %1 = addrspacecast i8 addrspace (1 )* %0 to i8*
155
- %cp64 = getelementptr inbounds %struct.Foo , %struct.Foo* %f , i64 0 , i32 2
156
- store i8* %1 , i8** %cp64 , align 8
157
- tail call void @use_foo (%struct.Foo* %f )
153
+ %0 = load ptr addrspace (1 ), ptr inttoptr (i64 1032 to ptr ), align 8
154
+ %1 = addrspacecast ptr addrspace (1 ) %0 to ptr
155
+ %cp64 = getelementptr inbounds %struct.Foo , ptr %f , i64 0 , i32 2
156
+ store ptr %1 , ptr %cp64 , align 8
157
+ tail call void @use_foo (ptr %f )
158
158
ret void
159
159
}
160
160
161
- define void @test_indexing_2 (%struct.Foo* %f ) {
161
+ define void @test_indexing_2 (ptr %f ) {
162
162
entry:
163
163
; CHECK-LABEL: test_indexing_2:
164
164
; CHECK: lhi 0, 16
165
165
; CHECK-NEXT: a 0, 1032
166
166
; CHECK-NEXT: llgtr 2, 0
167
167
; CHECK: lg 0, 24(2)
168
168
; CHECK: stg 0, 16(1)
169
- %0 = load i8** addrspace (1 )*, i8** addrspace ( 1 )** inttoptr (i64 1032 to i8** addrspace ( 1 )** ), align 8
170
- %arrayidx = getelementptr inbounds i8** , i8** addrspace (1 )* %0 , i32 2
171
- %1 = load i8** , i8** addrspace (1 )* %arrayidx , align 8
172
- %arrayidx1 = getelementptr inbounds i8* , i8** %1 , i64 3
173
- %2 = bitcast i8** %arrayidx1 to i64*
174
- %3 = load i64 , i64* %2 , align 8
175
- %cp64 = getelementptr inbounds %struct.Foo , %struct.Foo* %f , i64 0 , i32 2
176
- %4 = bitcast i8** %cp64 to i64*
177
- store i64 %3 , i64* %4 , align 8
178
- tail call void @use_foo (%struct.Foo* %f )
169
+ %0 = load ptr addrspace (1 ), ptr inttoptr (i64 1032 to ptr ), align 8
170
+ %arrayidx = getelementptr inbounds ptr , ptr addrspace (1 ) %0 , i32 2
171
+ %1 = load ptr , ptr addrspace (1 ) %arrayidx , align 8
172
+ %arrayidx1 = getelementptr inbounds ptr , ptr %1 , i64 3
173
+ %2 = bitcast ptr %arrayidx1 to ptr
174
+ %3 = load i64 , ptr %2 , align 8
175
+ %cp64 = getelementptr inbounds %struct.Foo , ptr %f , i64 0 , i32 2
176
+ %4 = bitcast ptr %cp64 to ptr
177
+ store i64 %3 , ptr %4 , align 8
178
+ tail call void @use_foo (ptr %f )
179
179
ret void
180
180
}
181
181
182
- define i64* @test_misc () {
182
+ define ptr @test_misc () {
183
183
entry:
184
184
; CHECK-LABEL: test_misc:
185
185
; CHECK: lhi 0, 88
@@ -189,20 +189,20 @@ entry:
189
189
; CHECK-NEXT: lg 1, 8(1)
190
190
; CHECK-NEXT: lg 1, 904(1)
191
191
; CHECK-NEXT: lg 3, 1192(1)
192
- %0 = load i8**** addrspace (1 )*, i8**** addrspace ( 1 )** inttoptr (i64 1208 to i8**** addrspace ( 1 )** ), align 8
193
- %arrayidx = getelementptr inbounds i8**** , i8**** addrspace (1 )* %0 , i32 11
194
- %1 = load i8**** , i8**** addrspace (1 )* %arrayidx , align 8
195
- %arrayidx1 = getelementptr inbounds i8*** , i8**** %1 , i64 1
196
- %2 = load i8*** , i8**** %arrayidx1 , align 8
197
- %arrayidx2 = getelementptr inbounds i8** , i8*** %2 , i64 113
198
- %3 = load i8** , i8*** %arrayidx2 , align 8
199
- %arrayidx3 = getelementptr inbounds i8* , i8** %3 , i64 149
200
- %4 = bitcast i8** %arrayidx3 to i64**
201
- %5 = load i64* , i64** %4 , align 8
202
- ret i64* %5
192
+ %0 = load ptr addrspace (1 ), ptr inttoptr (i64 1208 to ptr ), align 8
193
+ %arrayidx = getelementptr inbounds ptr , ptr addrspace (1 ) %0 , i32 11
194
+ %1 = load ptr , ptr addrspace (1 ) %arrayidx , align 8
195
+ %arrayidx1 = getelementptr inbounds ptr , ptr %1 , i64 1
196
+ %2 = load ptr , ptr %arrayidx1 , align 8
197
+ %arrayidx2 = getelementptr inbounds ptr , ptr %2 , i64 113
198
+ %3 = load ptr , ptr %arrayidx2 , align 8
199
+ %arrayidx3 = getelementptr inbounds ptr , ptr %3 , i64 149
200
+ %4 = bitcast ptr %arrayidx3 to ptr
201
+ %5 = load ptr , ptr %4 , align 8
202
+ ret ptr %5
203
203
}
204
204
205
- define i8 addrspace (1 )* addrspace ( 1 )* @test_misc_2 () {
205
+ define ptr addrspace (1 ) @test_misc_2 () {
206
206
entry:
207
207
; CHECK-LABEL: test_misc_2:
208
208
; CHECK: lhi 0, 544
@@ -211,25 +211,25 @@ entry:
211
211
; CHECK: lhi 0, 24
212
212
; CHECK: a 0, 0(1)
213
213
; CHECK: llgtr 1, 0
214
- %0 = load i8 addrspace (1 )* addrspace ( 1 )* addrspace ( 1 )* addrspace ( 1 )*, i8 addrspace ( 1 )* addrspace ( 1 )* addrspace ( 1 )* addrspace ( 1 )** inttoptr (i64 16 to i8 addrspace ( 1 )* addrspace ( 1 )* addrspace ( 1 )* addrspace ( 1 )** ), align 16
215
- %arrayidx = getelementptr inbounds i8 addrspace (1 )* addrspace ( 1 )* addrspace ( 1 )*, i8 addrspace (1 )* addrspace ( 1 )* addrspace ( 1 )* addrspace ( 1 )* %0 , i32 136
216
- %1 = load i8 addrspace (1 )* addrspace ( 1 )* addrspace ( 1 )*, i8 addrspace (1 )* addrspace ( 1 )* addrspace ( 1 )* addrspace ( 1 )* %arrayidx , align 4
217
- %arrayidx1 = getelementptr inbounds i8 addrspace (1 )* addrspace ( 1 )*, i8 addrspace (1 )* addrspace ( 1 )* addrspace ( 1 )* %1 , i32 6
218
- %2 = load i8 addrspace (1 )* addrspace ( 1 )*, i8 addrspace (1 )* addrspace ( 1 )* addrspace ( 1 )* %arrayidx1 , align 4
219
- ret i8 addrspace (1 )* addrspace ( 1 )* %2
214
+ %0 = load ptr addrspace (1 ), ptr inttoptr (i64 16 to ptr ), align 16
215
+ %arrayidx = getelementptr inbounds ptr addrspace (1 ), ptr addrspace (1 ) %0 , i32 136
216
+ %1 = load ptr addrspace (1 ), ptr addrspace (1 ) %arrayidx , align 4
217
+ %arrayidx1 = getelementptr inbounds ptr addrspace (1 ), ptr addrspace (1 ) %1 , i32 6
218
+ %2 = load ptr addrspace (1 ), ptr addrspace (1 ) %arrayidx1 , align 4
219
+ ret ptr addrspace (1 ) %2
220
220
}
221
221
222
- define zeroext i16 @test_misc_3 () local_unnamed_addr # 3 {
222
+ define zeroext i16 @test_misc_3 () {
223
223
entry:
224
224
; CHECK-LABEL: test_misc_3:
225
- ; CHECK: lhi 0, 36
226
- ; CHECK-NEXT: a 0, 548
225
+ ; CHECK: a 0, 548
227
226
; CHECK-NEXT: llgtr 1, 0
228
227
; CHECK-NEXT: llgh 3, 0(1)
229
- %0 = load i16 addrspace (1 )*, i16 addrspace (1 )** inttoptr (i64 548 to i16 addrspace (1 )**), align 4
230
- %arrayidx2 = getelementptr inbounds i16 , i16 addrspace (1 )* %0 , i32 18
231
- %arrayidx = addrspacecast i16 addrspace (1 )* %arrayidx2 to i16*
232
- %1 = load i16 , i16* %arrayidx , align 2
228
+ ; CHECK-NEXT: b 2(7)
229
+ %0 = load ptr addrspace (1 ), ptr inttoptr (i64 548 to ptr ), align 4
230
+ %arrayidx2 = getelementptr inbounds i16 , ptr addrspace (1 ) %0 , i32 18
231
+ %arrayidx = addrspacecast ptr addrspace (1 ) %arrayidx2 to ptr
232
+ %1 = load i16 , ptr %arrayidx , align 2
233
233
ret i16 %1
234
234
}
235
235
@@ -244,34 +244,34 @@ entry:
244
244
; CHECK-NEXT: lg 1, 984(1)
245
245
; CHECK-NEXT: iilf 0, 67240703
246
246
; CHECK-NEXT: c 0, 80(1)
247
- %0 = load i8*** addrspace (1 )*, i8*** addrspace ( 1 )** inttoptr (i64 1208 to i8*** addrspace ( 1 )** ), align 8
248
- %arrayidx = getelementptr inbounds i8*** , i8*** addrspace (1 )* %0 , i32 11
249
- %1 = load i8*** , i8*** addrspace (1 )* %arrayidx , align 8
250
- %arrayidx1 = getelementptr inbounds i8** , i8*** %1 , i64 1
251
- %2 = load i8** , i8*** %arrayidx1 , align 8
252
- %arrayidx2 = getelementptr inbounds i8* , i8** %2 , i64 123
253
- %3 = load i8* , i8** %arrayidx2 , align 8
254
- %add.ptr = getelementptr inbounds i8 , i8* %3 , i64 80
255
- %4 = bitcast i8* %add.ptr to i32*
256
- %5 = load i32 , i32* %4 , align 4
247
+ %0 = load ptr addrspace (1 ), ptr inttoptr (i64 1208 to ptr ), align 8
248
+ %arrayidx = getelementptr inbounds ptr , ptr addrspace (1 ) %0 , i32 11
249
+ %1 = load ptr , ptr addrspace (1 ) %arrayidx , align 8
250
+ %arrayidx1 = getelementptr inbounds ptr , ptr %1 , i64 1
251
+ %2 = load ptr , ptr %arrayidx1 , align 8
252
+ %arrayidx2 = getelementptr inbounds ptr , ptr %2 , i64 123
253
+ %3 = load ptr , ptr %arrayidx2 , align 8
254
+ %add.ptr = getelementptr inbounds i8 , ptr %3 , i64 80
255
+ %4 = bitcast ptr %add.ptr to ptr
256
+ %5 = load i32 , ptr %4 , align 4
257
257
%cmp = icmp sgt i32 %5 , 67240703
258
258
%conv = zext i1 %cmp to i32
259
259
ret i32 %conv
260
260
}
261
261
262
- define void @test_misc_5 (%struct.Foo* %f ) {
262
+ define void @test_misc_5 (ptr %f ) {
263
263
entry:
264
264
; CHECK-LABEL: test_misc_5:
265
265
; CHECK: l 0, 548
266
266
; CHECK-NEXT: lg 6, 8(5)
267
267
; CHECK-NEXT: lg 5, 0(5)
268
268
; CHECK-NEXT: llgtr 0, 0
269
269
; CHECK-NEXT: stg 0, 16(1)
270
- %0 = load i8 addrspace (1 )*, i8 addrspace ( 1 )** inttoptr (i64 548 to i8 addrspace ( 1 )** ), align 4
271
- %1 = addrspacecast i8 addrspace (1 )* %0 to i8*
272
- %cp64 = getelementptr inbounds %struct.Foo , %struct.Foo* %f , i64 0 , i32 2
273
- store i8* %1 , i8** %cp64 , align 8
274
- tail call void @use_foo (%struct.Foo* %f )
270
+ %0 = load ptr addrspace (1 ), ptr inttoptr (i64 548 to ptr ), align 4
271
+ %1 = addrspacecast ptr addrspace (1 ) %0 to ptr
272
+ %cp64 = getelementptr inbounds %struct.Foo , ptr %f , i64 0 , i32 2
273
+ store ptr %1 , ptr %cp64 , align 8
274
+ tail call void @use_foo (ptr %f )
275
275
ret void
276
276
}
277
277
@@ -285,11 +285,11 @@ entry:
285
285
; CHECK-NEXT: a 0, 0(1)
286
286
; CHECK-NEXT: llgtr 1, 0
287
287
; CHECK-NEXT: lgb 3, 0(1)
288
- %0 = load i8 addrspace (1 )* addrspace ( 1 )*, i8 addrspace ( 1 )* addrspace ( 1 )** inttoptr (i64 16 to i8 addrspace ( 1 )* addrspace ( 1 )** ), align 16
289
- %arrayidx = getelementptr inbounds i8 addrspace (1 )*, i8 addrspace (1 )* addrspace ( 1 )* %0 , i32 165
290
- %1 = load i8 addrspace (1 )*, i8 addrspace (1 )* addrspace ( 1 )* %arrayidx , align 4
291
- %arrayidx1 = getelementptr inbounds i8 , i8 addrspace (1 )* %1 , i32 53
292
- %2 = load i8 , i8 addrspace (1 )* %arrayidx1 , align 1
288
+ %0 = load ptr addrspace (1 ), ptr inttoptr (i64 16 to ptr ), align 16
289
+ %arrayidx = getelementptr inbounds ptr addrspace (1 ), ptr addrspace (1 ) %0 , i32 165
290
+ %1 = load ptr addrspace (1 ), ptr addrspace (1 ) %arrayidx , align 4
291
+ %arrayidx1 = getelementptr inbounds i8 , ptr addrspace (1 ) %1 , i32 53
292
+ %2 = load i8 , ptr addrspace (1 ) %arrayidx1 , align 1
293
293
%conv = sext i8 %2 to i32
294
294
ret i32 %conv
295
295
}
@@ -312,10 +312,10 @@ entry:
312
312
; CHECK-NEXT: lg 7, 2072(4)
313
313
; CHECK-NEXT: aghi 4, 192
314
314
; CHECK-NEXT: b 2(7)
315
- tail call void (i32 , ...) @g (i32 noundef signext 5 , i8 addrspace (1 )* noundef %p , i8 addrspace (1 )* noundef %p , i8 addrspace (1 )* noundef %p , i8 addrspace (1 )* noundef %p , i8 addrspace (1 )* noundef %p )
316
- ret void
315
+ tail call void (i32 , ...) @g (i32 noundef signext 5 , ptr addrspace (1 ) noundef %p , ptr addrspace (1 ) noundef %p , ptr addrspace (1 ) noundef %p , ptr addrspace (1 ) noundef %p , ptr addrspace (1 ) noundef %p )
316
+ ret void
317
317
}
318
- declare void @g (i32 noundef signext , ...)
318
+ declare void @g (i32 signext , ...)
319
319
320
320
; The resulting instructions may look odd on first view but it is a result of
321
321
; the C code. __malloc31() returns a 64 bit pointer, thus the sequence
@@ -336,12 +336,12 @@ define signext i32 @setlength() {
336
336
; CHECK: llgtr [[ADDR]], [[ADDR]]
337
337
; CHECK: stg [[LENGTH]], 0([[ADDR]])
338
338
entry:
339
- %call = tail call i8* @__malloc31 (i64 noundef 8 )
340
- %call1 = tail call signext i32 bitcast ( i32 (...)* @foo to i32 ()*) ()
341
- %length = getelementptr inbounds i8 , i8* %call , i64 4
342
- %0 = bitcast i8* %length to i32*
343
- %1 = addrspacecast i32* %0 to i32 addrspace (1 )*
344
- store i32 %call1 , i32 addrspace (1 )* %1 , align 4
339
+ %call = tail call ptr @__malloc31 (i64 noundef 8 )
340
+ %call1 = tail call signext i32 @foo ()
341
+ %length = getelementptr inbounds i8 , ptr %call , i64 4
342
+ %0 = bitcast ptr %length to ptr
343
+ %1 = addrspacecast ptr %0 to ptr addrspace (1 )
344
+ store i32 %call1 , ptr addrspace (1 ) %1 , align 4
345
345
ret i32 0
346
346
}
347
347
@@ -350,7 +350,7 @@ entry:
350
350
; instead of __malloc31(). Note the different instruction sequence, because
351
351
; the function now returns a __ptr32.
352
352
;
353
- define hidden signext i32 @setlength2 () {
353
+ define signext i32 @setlength2 () {
354
354
; CHECK-LABEL: setlength2:
355
355
; CHECK: basr 7, 6
356
356
; CHECK: lgr [[MALLOC:[0-9]+]], 3
@@ -360,16 +360,16 @@ define hidden signext i32 @setlength2() {
360
360
; CHECK: llgtr [[ADDR]], [[MALLOC]]
361
361
; CHECK: stg [[LENGTH]], 0([[ADDR]])
362
362
entry:
363
- %call = tail call i8 addrspace (1 )* @domalloc (i64 noundef 8 )
364
- %call1 = tail call signext i32 bitcast ( i32 (...)* @foo to i32 ()*)() # 2
365
- %length = getelementptr inbounds i8 , i8 addrspace (1 )* %call , i32 4
366
- %0 = bitcast i8 addrspace (1 )* %length to i32 addrspace (1 )*
367
- store i32 %call1 , i32 addrspace (1 )* %0 , align 4
363
+ %call = tail call ptr addrspace (1 ) @domalloc (i64 noundef 8 )
364
+ %call1 = tail call signext i32 @foo ()
365
+ %length = getelementptr inbounds i8 , ptr addrspace (1 ) %call , i32 4
366
+ %0 = bitcast ptr addrspace (1 ) %length to ptr addrspace (1 )
367
+ store i32 %call1 , ptr addrspace (1 ) %0 , align 4
368
368
ret i32 0
369
369
}
370
370
371
- declare i8* @__malloc31 (i64 noundef )
371
+ declare ptr @__malloc31 (i64 )
372
372
373
373
declare signext i32 @foo (...)
374
374
375
- declare i8 addrspace (1 )* @domalloc (i64 noundef )
375
+ declare ptr addrspace (1 ) @domalloc (i64 )
0 commit comments