OLD | NEW |
---|---|
1 ; RUN: opt %s -replace-ptrs-with-ints -S | FileCheck %s | 1 ; RUN: opt %s -replace-ptrs-with-ints -S | FileCheck %s |
2 | 2 |
3 target datalayout = "p:32:32:32" | 3 target datalayout = "p:32:32:32" |
4 | 4 |
5 | 5 |
6 %struct = type { i32, i32 } | 6 %struct = type { i32, i32 } |
7 | 7 |
8 declare %struct* @addr_taken_func(%struct*) | 8 declare %struct* @addr_taken_func(%struct*) |
9 | 9 |
10 @addr_of_func = global %struct* (%struct*)* @addr_taken_func | 10 @addr_of_func = global %struct* (%struct*)* @addr_taken_func |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 | 238 |
239 define void @store_ptr(i8** %ptr, i8* %val) { | 239 define void @store_ptr(i8** %ptr, i8* %val) { |
240 store i8* %val, i8** %ptr | 240 store i8* %val, i8** %ptr |
241 ret void | 241 ret void |
242 } | 242 } |
243 ; CHECK: define void @store_ptr(i32 %ptr, i32 %val) { | 243 ; CHECK: define void @store_ptr(i32 %ptr, i32 %val) { |
244 ; CHECK-NEXT: %ptr.asptr = inttoptr i32 %ptr to i32* | 244 ; CHECK-NEXT: %ptr.asptr = inttoptr i32 %ptr to i32* |
245 ; CHECK-NEXT: store i32 %val, i32* %ptr.asptr | 245 ; CHECK-NEXT: store i32 %val, i32* %ptr.asptr |
246 | 246 |
247 | 247 |
248 define i8 @load_attrs(i8* %ptr) { | |
Mark Seaborn
2013/06/26 14:33:41
Please leave this in. ReplacePtrsWithInts still h
JF
2013/06/26 15:52:29
Done.
| |
249 %x = load atomic volatile i8* %ptr seq_cst, align 128 | |
250 ret i8 %x | |
251 } | |
252 ; CHECK: define i8 @load_attrs(i32 %ptr) { | |
253 ; CHECK-NEXT: %ptr.asptr = inttoptr i32 %ptr to i8* | |
254 ; CHECK-NEXT: %x = load atomic volatile i8* %ptr.asptr seq_cst, align 128 | |
255 | |
256 define void @store_attrs(i8* %ptr, i8 %val) { | |
257 store atomic volatile i8 %val, i8* %ptr singlethread release, align 256 | |
258 ret void | |
259 } | |
260 ; CHECK: define void @store_attrs(i32 %ptr, i8 %val) { | |
261 ; CHECK-NEXT: %ptr.asptr = inttoptr i32 %ptr to i8* | |
262 ; CHECK-NEXT: store atomic volatile i8 %val, i8* %ptr.asptr singlethread release , align 256 | |
263 | |
264 | |
265 define i32 @cmpxchg(i32* %ptr, i32 %a, i32 %b) { | |
266 %r = cmpxchg i32* %ptr, i32 %a, i32 %b seq_cst | |
267 ret i32 %r | |
268 } | |
269 ; CHECK: define i32 @cmpxchg(i32 %ptr, i32 %a, i32 %b) { | |
270 ; CHECK-NEXT: %ptr.asptr = inttoptr i32 %ptr to i32* | |
271 ; CHECK-NEXT: %r = cmpxchg i32* %ptr.asptr, i32 %a, i32 %b seq_cst | |
272 | |
273 define i32 @atomicrmw(i32* %ptr, i32 %x) { | |
274 %r = atomicrmw add i32* %ptr, i32 %x seq_cst | |
275 ret i32 %r | |
276 } | |
277 ; CHECK: define i32 @atomicrmw(i32 %ptr, i32 %x) { | |
278 ; CHECK-NEXT: %ptr.asptr = inttoptr i32 %ptr to i32* | |
279 ; CHECK-NEXT: %r = atomicrmw add i32* %ptr.asptr, i32 %x seq_cst | |
280 | |
281 | |
282 define i8* @indirect_call(i8* (i8*)* %func, i8* %arg) { | 248 define i8* @indirect_call(i8* (i8*)* %func, i8* %arg) { |
283 %result = call i8* %func(i8* %arg) | 249 %result = call i8* %func(i8* %arg) |
284 ret i8* %result | 250 ret i8* %result |
285 } | 251 } |
286 ; CHECK: define i32 @indirect_call(i32 %func, i32 %arg) { | 252 ; CHECK: define i32 @indirect_call(i32 %func, i32 %arg) { |
287 ; CHECK-NEXT: %func.asptr = inttoptr i32 %func to i32 (i32)* | 253 ; CHECK-NEXT: %func.asptr = inttoptr i32 %func to i32 (i32)* |
288 ; CHECK-NEXT: %result = call i32 %func.asptr(i32 %arg) | 254 ; CHECK-NEXT: %result = call i32 %func.asptr(i32 %arg) |
289 ; CHECK-NEXT: ret i32 %result | 255 ; CHECK-NEXT: ret i32 %result |
290 | 256 |
291 | 257 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
630 %bc = bitcast i32* @typeid to i8* | 596 %bc = bitcast i32* @typeid to i8* |
631 call i32 @llvm.eh.typeid.for(i8* %bc) | 597 call i32 @llvm.eh.typeid.for(i8* %bc) |
632 ret void | 598 ret void |
633 } | 599 } |
634 ; CHECK: define void @typeid_for() { | 600 ; CHECK: define void @typeid_for() { |
635 ; CHECK-NEXT: %typeid.bc = bitcast i32* @typeid to i8* | 601 ; CHECK-NEXT: %typeid.bc = bitcast i32* @typeid to i8* |
636 ; CHECK-NEXT: call i32 @llvm.eh.typeid.for(i8* %typeid.bc) | 602 ; CHECK-NEXT: call i32 @llvm.eh.typeid.for(i8* %typeid.bc) |
637 | 603 |
638 | 604 |
639 ; CHECK: attributes {{.*}}[[NOUNWIND]] = { nounwind } | 605 ; CHECK: attributes {{.*}}[[NOUNWIND]] = { nounwind } |
OLD | NEW |