mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-13 23:18:51 +00:00
fd8928ded9
The pointer size of the addrspacecasted pointer might not have matched, so this would have hit an assert in accumulateConstantOffset. I think this was here to allow constant folding of a load of an addrspacecasted constant. Accumulating the offset through the addrspacecast doesn't make much sense, so something else is necessary to allow folding the load through this cast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243300 91177308-0d34-0410-b5e6-96231b3b80d8
31 lines
1.0 KiB
LLVM
31 lines
1.0 KiB
LLVM
; RUN: opt -S -inline < %s | FileCheck %s
|
|
|
|
target datalayout = "e-p3:32:32-p4:64:64-n32"
|
|
|
|
@lds = internal addrspace(3) global [64 x i64] zeroinitializer
|
|
|
|
; CHECK-LABEL: @constexpr_addrspacecast_ptr_size_change(
|
|
; 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)
|
|
; CHECK-NEXT: br
|
|
define void @constexpr_addrspacecast_ptr_size_change() #0 {
|
|
%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
|
|
ret void
|
|
}
|
|
|
|
define i32 @foo(i64 addrspace(4)* %arg) #1 {
|
|
bb:
|
|
%tmp = getelementptr i64, i64 addrspace(4)* %arg, i64 undef
|
|
%tmp1 = load i64, i64 addrspace(4)* %tmp
|
|
br i1 undef, label %bb2, label %bb3
|
|
|
|
bb2:
|
|
store i64 0, i64 addrspace(4)* %tmp
|
|
br label %bb3
|
|
|
|
bb3:
|
|
unreachable
|
|
}
|
|
|
|
attributes #0 = { nounwind }
|
|
attributes #1 = { alwaysinline nounwind }
|