1 ; RUN: opt -passes=gvn -S < %s | FileCheck %s
3 ; Make sure we don't crash when analyzing an addrspacecast in
4 ; GetPointerBaseWithConstantOffset()
6 target datalayout = "e-p:32:32-p4:64:64"
8 define i32 @addrspacecast-crash() {
9 ; CHECK-LABEL: @addrspacecast-crash
10 ; CHECK: %tmp = alloca [25 x i64]
11 ; CHECK: %tmp2 = addrspacecast ptr %tmp to ptr addrspace(4)
12 ; CHECK: store <8 x i64> zeroinitializer, ptr addrspace(4) %tmp2
15 %tmp = alloca [25 x i64]
16 %tmp2 = addrspacecast ptr %tmp to ptr addrspace(4)
17 store <8 x i64> zeroinitializer, ptr addrspace(4) %tmp2
18 %tmp5 = addrspacecast ptr %tmp to ptr addrspace(4)
19 %tmp6 = getelementptr inbounds i32, ptr addrspace(4) %tmp5, i64 10
20 %tmp7 = load i32, ptr addrspace(4) %tmp6, align 4