mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
204d4c1d7b
LLVM makes several assumptions about address space 0. However, alloca is presently constrained to always return this address space. There's no real way to avoid using alloca, so without this there is no way to opt out of these assumptions. The problematic assumptions include: - That the pointer size used for the stack is the same size as the code size pointer, which is also the maximum sized pointer. - That 0 is an invalid, non-dereferencable pointer value. These are problems for AMDGPU because alloca is used to implement the private address space, which uses a 32-bit index as the pointer value. Other pointers are 64-bit and behave more like LLVM's notion of generic address space. By changing the address space used for allocas, we can change our generic pointer type to be LLVM's generic pointer type which does have similar properties. llvm-svn: 299888
25 lines
1001 B
LLVM
25 lines
1001 B
LLVM
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
|
|
|
|
target datalayout = "A0"
|
|
; CHECK: target datalayout = "A0"
|
|
|
|
|
|
; CHECK: %alloca_scalar_no_align = alloca i32
|
|
; CHECK-NEXT: %alloca_scalar_align4 = alloca i32, align 4
|
|
; CHECK-NEXT: %alloca_scalar_no_align_metadata = alloca i32, !foo !0
|
|
; CHECK-NEXT: %alloca_scalar_align4_metadata = alloca i32, align 4, !foo !0
|
|
; CHECK-NEXT: %alloca_inalloca_scalar_no_align = alloca inalloca i32
|
|
; CHECK-NEXT: %alloca_inalloca_scalar_align4_metadata = alloca inalloca i32, align 4, !foo !0
|
|
define void @use_alloca() {
|
|
%alloca_scalar_no_align = alloca i32, addrspace(0)
|
|
%alloca_scalar_align4 = alloca i32, align 4, addrspace(0)
|
|
%alloca_scalar_no_align_metadata = alloca i32, addrspace(0), !foo !0
|
|
%alloca_scalar_align4_metadata = alloca i32, align 4, addrspace(0), !foo !0
|
|
%alloca_inalloca_scalar_no_align = alloca inalloca i32, addrspace(0)
|
|
%alloca_inalloca_scalar_align4_metadata = alloca inalloca i32, align 4, addrspace(0), !foo !0
|
|
|
|
ret void
|
|
}
|
|
|
|
!0 = !{}
|