Matt Arsenault | 95365ca | 2015-07-27 18:31:03 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -inline < %s | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-p3:32:32-p4:64:64-n32" |
| 4 | |
| 5 | @lds = internal addrspace(3) global [64 x i64] zeroinitializer |
| 6 | |
| 7 | ; CHECK-LABEL: @constexpr_addrspacecast_ptr_size_change( |
| 8 | ; CHECK: load i64, i64 addrspace(4)* getelementptr (i64, i64 addrspace(4)* addrspacecast (i64 addrspace(3)* getelementptr inbounds ([64 x i64], [64 x i64] addrspace(3)* @lds, i32 0, i32 0) to i64 addrspace(4)*), i64 undef) |
| 9 | ; CHECK-NEXT: br |
| 10 | define void @constexpr_addrspacecast_ptr_size_change() #0 { |
| 11 | %tmp0 = call i32 @foo(i64 addrspace(4)* addrspacecast (i64 addrspace(3)* getelementptr inbounds ([64 x i64], [64 x i64] addrspace(3)* @lds, i32 0, i32 0) to i64 addrspace(4)*)) #1 |
| 12 | ret void |
| 13 | } |
| 14 | |
| 15 | define i32 @foo(i64 addrspace(4)* %arg) #1 { |
| 16 | bb: |
| 17 | %tmp = getelementptr i64, i64 addrspace(4)* %arg, i64 undef |
| 18 | %tmp1 = load i64, i64 addrspace(4)* %tmp |
| 19 | br i1 undef, label %bb2, label %bb3 |
| 20 | |
| 21 | bb2: |
| 22 | store i64 0, i64 addrspace(4)* %tmp |
| 23 | br label %bb3 |
| 24 | |
| 25 | bb3: |
| 26 | unreachable |
| 27 | } |
| 28 | |
| 29 | attributes #0 = { nounwind } |
| 30 | attributes #1 = { alwaysinline nounwind } |