1; RUN: opt -S -inline < %s | FileCheck %s
2; RUN: opt -S -passes='cgscc(inline)' < %s | FileCheck %s
3; RUN: opt -S -passes='module-inline' < %s | FileCheck %s
4
5target datalayout = "e-p3:32:32-p4:64:64-n32"
6
7@lds = internal addrspace(3) global [64 x i64] zeroinitializer
8
9; CHECK-LABEL: @constexpr_addrspacecast_ptr_size_change(
10; CHECK: load 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)*)
11; CHECK-NEXT: br
12define void @constexpr_addrspacecast_ptr_size_change() #0 {
13  %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
14  ret void
15}
16
17define i32 @foo(i64 addrspace(4)* %arg) #1 {
18bb:
19  %tmp = getelementptr i64, i64 addrspace(4)* %arg, i64 undef
20  %tmp1 = load i64, i64 addrspace(4)* %tmp
21  br i1 undef, label %bb2, label %bb3
22
23bb2:
24  store i64 0, i64 addrspace(4)* %tmp
25  br label %bb3
26
27bb3:
28  unreachable
29}
30
31attributes #0 = { nounwind }
32attributes #1 = { alwaysinline nounwind }
33