summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-06-07 20:52:05 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-06-07 20:52:05 +0000
commitdf74b86e1e9ee32e08c22f7eef51da0b65ec053d (patch)
tree799aa55a74f49e7dc1c5467bf9a6521588cb4fa0 /test
parentfc61b6f111af79662baf273c40593a1e8f4dc719 (diff)
downloadllvm-df74b86e1e9ee32e08c22f7eef51da0b65ec053d.tar.gz
llvm-df74b86e1e9ee32e08c22f7eef51da0b65ec053d.tar.bz2
llvm-df74b86e1e9ee32e08c22f7eef51da0b65ec053d.tar.xz
R600: Fix calculation of stack offset in AMDGPUFrameLowering
We weren't computing structure size correctly and we were relying on the original alloca instruction to compute the offset, which isn't always reliable. Reviewed-by: Vincent Lejeune <vljn@ovi.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183568 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/R600/indirect-addressing.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/CodeGen/R600/indirect-addressing.ll b/test/CodeGen/R600/indirect-addressing.ll
index 7291cb42e7..bd72cd96e2 100644
--- a/test/CodeGen/R600/indirect-addressing.ll
+++ b/test/CodeGen/R600/indirect-addressing.ll
@@ -30,3 +30,36 @@ entry:
store i32 %3, i32 addrspace(1)* %arrayidx13
ret void
}
+
+; This test checks that the stack offset is calculated correctly for structs.
+; All register loads/stores should be optimized away, so there shouldn't be
+; any MOVA instructions.
+;
+; XXX: This generated code has unnecessary MOVs, we should be able to optimize
+; this.
+
+; CHECK: @multiple_structs
+; CHECK-NOT: MOVA_INT
+
+%struct.point = type { i32, i32 }
+
+define void @multiple_structs(i32 addrspace(1)* %out) {
+entry:
+ %a = alloca %struct.point
+ %b = alloca %struct.point
+ %a.x.ptr = getelementptr %struct.point* %a, i32 0, i32 0
+ %a.y.ptr = getelementptr %struct.point* %a, i32 0, i32 1
+ %b.x.ptr = getelementptr %struct.point* %b, i32 0, i32 0
+ %b.y.ptr = getelementptr %struct.point* %b, i32 0, i32 1
+ store i32 0, i32* %a.x.ptr
+ store i32 1, i32* %a.y.ptr
+ store i32 2, i32* %b.x.ptr
+ store i32 3, i32* %b.y.ptr
+ %a.indirect.ptr = getelementptr %struct.point* %a, i32 0, i32 0
+ %b.indirect.ptr = getelementptr %struct.point* %b, i32 0, i32 0
+ %a.indirect = load i32* %a.indirect.ptr
+ %b.indirect = load i32* %b.indirect.ptr
+ %0 = add i32 %a.indirect, %b.indirect
+ store i32 %0, i32 addrspace(1)* %out
+ ret void
+}