1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
llvm-mirror/test/CodeGen/AMDGPU/gv-offset-folding.ll
Tom Stellard 42668f326d AMDGPU/SI: Make sure not to fold offsets into local address space globals
Summary:
Offset folding only works if you are emitting relocations, and we don't
emit relocations for local address space globals.

Reviewers: arsenm, nhaustov

Subscribers: arsenm, llvm-commits, kzhuravl

Differential Revision: http://reviews.llvm.org/D21647

llvm-svn: 273765
2016-06-25 01:59:16 +00:00

22 lines
827 B
LLVM

; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=fiji -relocation-model=static < %s | FileCheck %s
@lds = external addrspace(3) global [4 x i32]
; Function Attrs: nounwind
; Offset folding is an optimization done for global variables with relocations,
; which allows you to store the offset in the r_addend of the relocation entry.
; The offset is apllied to the variables address at link time, which eliminates
; the need to emit shader instructions to do this calculation.
; We don't use relocations for local memory, so we should never fold offsets
; for local memory globals.
; CHECK-LABEL: lds_no_offset:
; CHECK ds_write_b32 v{{[0-9]+}}, v{{[0-9]+}} offset:4
define void @lds_no_offset() {
entry:
%ptr = getelementptr [4 x i32], [4 x i32] addrspace(3)* @lds, i32 0, i32 1
store i32 0, i32 addrspace(3)* %ptr
ret void
}