aboutsummaryrefslogtreecommitdiff
path: root/test/NaCl/Localmods
diff options
context:
space:
mode:
authorEli Bendersky <eliben@chromium.org>2013-07-18 07:57:42 -0700
committerEli Bendersky <eliben@chromium.org>2013-07-18 07:57:42 -0700
commit0592f0ef8bbc825243cb1860b09468a7605f8716 (patch)
tree32df1ad4733b4a155d979c64473417596de64bd6 /test/NaCl/Localmods
parent90bab6f3cf1edadfa34f3a3c9d767638ec745c75 (diff)
Port new tests from origin/master
Diffstat (limited to 'test/NaCl/Localmods')
-rw-r--r--test/NaCl/Localmods/arm-byval-ref-fix.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/NaCl/Localmods/arm-byval-ref-fix.ll b/test/NaCl/Localmods/arm-byval-ref-fix.ll
new file mode 100644
index 0000000000..13759a7f6a
--- /dev/null
+++ b/test/NaCl/Localmods/arm-byval-ref-fix.ll
@@ -0,0 +1,33 @@
+; RUN: pnacl-llc -march=arm -mtriple=armv7a-none-nacl %s -o - | FileCheck %s
+
+; byval is currently crashing on ARM for upstream LLVM (PR11018).
+; We have a LOCALMOD in ARMISelLowering to simply leave byval wholly
+; on the stack, so this is expected to pass.
+
+%struct.S = type { i32, i32 }
+
+define void @foo(%struct.S* byval %w) nounwind {
+entry:
+
+; Verify that 55 is stored onto the stack directly, so the struct is
+; passed by value and not by reference.
+
+; CHECK: foo:
+; CHECK-NEXT: entry
+; CHECK-NEXT: mov [[REG:r[0-9]+]], #55
+; CHECK-NEXT: str [[REG]], [sp]
+
+ %x = getelementptr inbounds %struct.S* %w, i32 0, i32 0
+ store i32 55, i32* %x, align 4
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ %w = alloca %struct.S, align 4
+ store %struct.S { i32 0, i32 0 }, %struct.S* %w
+ call void @foo(%struct.S* byval %w)
+ %x = getelementptr inbounds %struct.S* %w, i32 0, i32 0
+ %retval = load i32* %x, align 4
+ ret i32 %retval
+}