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