| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 %val = load i16* %ptr | 338 %val = load i16* %ptr |
| 339 ret i16 %val | 339 ret i16 %val |
| 340 } | 340 } |
| 341 ; CHECK: define i16 @load_global_bitcast() { | 341 ; CHECK: define i16 @load_global_bitcast() { |
| 342 ; CHECK-NEXT: %var.bc = bitcast i32* @var to i16* | 342 ; CHECK-NEXT: %var.bc = bitcast i32* @var to i16* |
| 343 ; CHECK-NEXT: %val = load i16* %var.bc | 343 ; CHECK-NEXT: %val = load i16* %var.bc |
| 344 ; CHECK-NEXT: ret i16 %val | 344 ; CHECK-NEXT: ret i16 %val |
| 345 | 345 |
| 346 | 346 |
| 347 declare void @receive_alloca(%struct* %ptr) | 347 declare void @receive_alloca(%struct* %ptr) |
| 348 declare void @receive_vector_alloca(<4 x i32>* %ptr) |
| 348 | 349 |
| 349 define void @alloca_fixed() { | 350 define void @alloca_fixed() { |
| 350 %buf = alloca %struct, align 128 | 351 %buf = alloca %struct, align 128 |
| 351 call void @receive_alloca(%struct* %buf) | 352 call void @receive_alloca(%struct* %buf) |
| 352 ret void | 353 ret void |
| 353 } | 354 } |
| 354 ; CHECK: define void @alloca_fixed() { | 355 ; CHECK: define void @alloca_fixed() { |
| 355 ; CHECK-NEXT: %buf = alloca i8, i32 8, align 128 | 356 ; CHECK-NEXT: %buf = alloca i8, i32 8, align 128 |
| 356 ; CHECK-NEXT: %buf.asint = ptrtoint i8* %buf to i32 | 357 ; CHECK-NEXT: %buf.asint = ptrtoint i8* %buf to i32 |
| 357 ; CHECK-NEXT: call void @receive_alloca(i32 %buf.asint) | 358 ; CHECK-NEXT: call void @receive_alloca(i32 %buf.asint) |
| 358 | 359 |
| 359 ; When the size passed to alloca is a constant, it should be a | 360 ; When the size passed to alloca is a constant, it should be a |
| 360 ; constant in the output too. | 361 ; constant in the output too. |
| 361 define void @alloca_fixed_array() { | 362 define void @alloca_fixed_array() { |
| 362 %buf = alloca %struct, i32 100 | 363 %buf = alloca %struct, i32 100 |
| 363 call void @receive_alloca(%struct* %buf) | 364 call void @receive_alloca(%struct* %buf) |
| 364 ret void | 365 ret void |
| 365 } | 366 } |
| 366 ; CHECK: define void @alloca_fixed_array() { | 367 ; CHECK: define void @alloca_fixed_array() { |
| 367 ; CHECK-NEXT: %buf = alloca i8, i32 800, align 8 | 368 ; CHECK-NEXT: %buf = alloca i8, i32 800, align 8 |
| 368 ; CHECK-NEXT: %buf.asint = ptrtoint i8* %buf to i32 | 369 ; CHECK-NEXT: %buf.asint = ptrtoint i8* %buf to i32 |
| 369 ; CHECK-NEXT: call void @receive_alloca(i32 %buf.asint) | 370 ; CHECK-NEXT: call void @receive_alloca(i32 %buf.asint) |
| 370 | 371 |
| 372 define void @alloca_fixed_vector() { |
| 373 %buf = alloca <4 x i32>, align 128 |
| 374 call void @receive_vector_alloca(<4 x i32>* %buf) |
| 375 ret void |
| 376 } |
| 377 ; CHECK: define void @alloca_fixed_vector() { |
| 378 ; CHECK-NEXT: %buf = alloca i8, i32 16, align 128 |
| 379 ; CHECK-NEXT: %buf.asint = ptrtoint i8* %buf to i32 |
| 380 ; CHECK-NEXT: call void @receive_vector_alloca(i32 %buf.asint) |
| 381 |
| 371 define void @alloca_variable(i32 %size) { | 382 define void @alloca_variable(i32 %size) { |
| 372 %buf = alloca %struct, i32 %size | 383 %buf = alloca %struct, i32 %size |
| 373 call void @receive_alloca(%struct* %buf) | 384 call void @receive_alloca(%struct* %buf) |
| 374 ret void | 385 ret void |
| 375 } | 386 } |
| 376 ; CHECK: define void @alloca_variable(i32 %size) { | 387 ; CHECK: define void @alloca_variable(i32 %size) { |
| 377 ; CHECK-NEXT: %buf.alloca_mul = mul i32 8, %size | 388 ; CHECK-NEXT: %buf.alloca_mul = mul i32 8, %size |
| 378 ; CHECK-NEXT: %buf = alloca i8, i32 %buf.alloca_mul | 389 ; CHECK-NEXT: %buf = alloca i8, i32 %buf.alloca_mul |
| 379 ; CHECK-NEXT: %buf.asint = ptrtoint i8* %buf to i32 | 390 ; CHECK-NEXT: %buf.asint = ptrtoint i8* %buf to i32 |
| 380 ; CHECK-NEXT: call void @receive_alloca(i32 %buf.asint) | 391 ; CHECK-NEXT: call void @receive_alloca(i32 %buf.asint) |
| 381 | 392 |
| 382 define void @alloca_alignment_i32() { | 393 define void @alloca_alignment_i32() { |
| 383 %buf = alloca i32 | 394 %buf = alloca i32 |
| 384 ret void | 395 ret void |
| 385 } | 396 } |
| 386 ; CHECK: void @alloca_alignment_i32() { | 397 ; CHECK: void @alloca_alignment_i32() { |
| 387 ; CHECK-NEXT: alloca i8, i32 4, align 4 | 398 ; CHECK-NEXT: alloca i8, i32 4, align 4 |
| 388 | 399 |
| 389 define void @alloca_alignment_double() { | 400 define void @alloca_alignment_double() { |
| 390 %buf = alloca double | 401 %buf = alloca double |
| 391 ret void | 402 ret void |
| 392 } | 403 } |
| 393 ; CHECK: void @alloca_alignment_double() { | 404 ; CHECK: void @alloca_alignment_double() { |
| 394 ; CHECK-NEXT: alloca i8, i32 8, align 8 | 405 ; CHECK-NEXT: alloca i8, i32 8, align 8 |
| 395 | 406 |
| 407 define void @alloca_alignment_vector() { |
| 408 %buf = alloca <4 x i32> |
| 409 ret void |
| 410 } |
| 411 ; CHECK: void @alloca_alignment_vector() { |
| 412 ; CHECK-NEXT: alloca i8, i32 16, align 16 |
| 413 |
| 396 define void @alloca_lower_alignment() { | 414 define void @alloca_lower_alignment() { |
| 397 %buf = alloca i32, align 1 | 415 %buf = alloca i32, align 1 |
| 398 ret void | 416 ret void |
| 399 } | 417 } |
| 400 ; CHECK: void @alloca_lower_alignment() { | 418 ; CHECK: void @alloca_lower_alignment() { |
| 401 ; CHECK-NEXT: alloca i8, i32 4, align 1 | 419 ; CHECK-NEXT: alloca i8, i32 4, align 1 |
| 402 | 420 |
| 403 | 421 |
| 404 ; This tests for a bug in which, when processing the store's %buf2 | 422 ; This tests for a bug in which, when processing the store's %buf2 |
| 405 ; operand, ReplacePtrsWithInts accidentally strips off the ptrtoint | 423 ; operand, ReplacePtrsWithInts accidentally strips off the ptrtoint |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 %bc = bitcast i32* @typeid to i8* | 655 %bc = bitcast i32* @typeid to i8* |
| 638 call i32 @llvm.eh.typeid.for(i8* %bc) | 656 call i32 @llvm.eh.typeid.for(i8* %bc) |
| 639 ret void | 657 ret void |
| 640 } | 658 } |
| 641 ; CHECK: define void @typeid_for() { | 659 ; CHECK: define void @typeid_for() { |
| 642 ; CHECK-NEXT: %typeid.bc = bitcast i32* @typeid to i8* | 660 ; CHECK-NEXT: %typeid.bc = bitcast i32* @typeid to i8* |
| 643 ; CHECK-NEXT: call i32 @llvm.eh.typeid.for(i8* %typeid.bc) | 661 ; CHECK-NEXT: call i32 @llvm.eh.typeid.for(i8* %typeid.bc) |
| 644 | 662 |
| 645 | 663 |
| 646 ; CHECK: attributes {{.*}}[[NOUNWIND]] = { nounwind } | 664 ; CHECK: attributes {{.*}}[[NOUNWIND]] = { nounwind } |
| OLD | NEW |