summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorStuart Hastings <stuart@apple.com>2011-05-26 02:44:56 +0000
committerStuart Hastings <stuart@apple.com>2011-05-26 02:44:56 +0000
commitaa4e6afc9be330770e0b5d41e79aa26c3115bcca (patch)
treeda54e6dcadc61d248dc1490c4c745276a0c110d3 /test/CodeGen
parentfcdc9a44e59ff2846c6f929e91c90ee34e6ba5d5 (diff)
downloadllvm-aa4e6afc9be330770e0b5d41e79aa26c3115bcca.tar.gz
llvm-aa4e6afc9be330770e0b5d41e79aa26c3115bcca.tar.bz2
llvm-aa4e6afc9be330770e0b5d41e79aa26c3115bcca.tar.xz
Correctly handle a one-word struct passed byval on x86_64.
rdar://problem/6920088 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/X86/2011-05-18-byval-in-reg.ll35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/CodeGen/X86/2011-05-18-byval-in-reg.ll b/test/CodeGen/X86/2011-05-18-byval-in-reg.ll
new file mode 100644
index 0000000000..18f0415ce4
--- /dev/null
+++ b/test/CodeGen/X86/2011-05-18-byval-in-reg.ll
@@ -0,0 +1,35 @@
+; RUN: llc < %s | FileCheck %s
+; rdar://problem/6920088
+;target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "x86_64-apple-darwin9.0"
+@"\01LC" = internal constant [2 x i8] c"a\00" ; <[2 x i8]*> [#uses=1]
+@"\01LC1" = internal constant [2 x i8] c"b\00" ; <[2 x i8]*> [#uses=1]
+@"\01LC2" = internal constant [2 x i8] c"c\00" ; <[2 x i8]*> [#uses=1]
+@"\01LC3" = internal constant [2 x i8] c"d\00" ; <[2 x i8]*> [#uses=1]
+@"\01LC4" = internal constant [2 x i8] c"e\00" ; <[2 x i8]*> [#uses=1]
+@"\01LC5" = internal constant [2 x i8] c"f\00" ; <[2 x i8]*> [#uses=1]
+@"\01LC6" = internal constant [2 x i8] c"g\00" ; <[2 x i8]*> [#uses=1]
+@"\01LC7" = internal constant [4 x i8] c"%s\0A\00" ; <[4 x i8]*> [#uses=1]
+
+define i32 @main(i32 %argc, i8** %argv) nounwind {
+entry:
+ %tmp = alloca i8* ; <i8**> [#uses=2]
+ %tmp1 = alloca i8* ; <i8**> [#uses=2]
+ %tmp2 = alloca i8* ; <i8**> [#uses=2]
+; CHECK: leaq LC4(%rip), [[AREG:%[a-z]+]]
+; CHECK-NEXT: movq [[AREG]], [[STKOFF:[0-9]+]](%rsp)
+ store i8* getelementptr ([2 x i8]* @"\01LC4", i32 0, i32 0), i8** %tmp
+ store i8* getelementptr ([2 x i8]* @"\01LC5", i32 0, i32 0), i8** %tmp1
+ store i8* getelementptr ([2 x i8]* @"\01LC6", i32 0, i32 0), i8** %tmp2
+; The LC4 struct should be passed in %r9:
+; CHECK: movq [[STKOFF]](%rsp), %r9
+ call void (i8**, ...)* @generate_password(i8** null,
+ i8* getelementptr ([2 x i8]* @"\01LC", i32 0, i32 0),
+ i8* getelementptr ([2 x i8]* @"\01LC1", i32 0, i32 0),
+ i8* getelementptr ([2 x i8]* @"\01LC2", i32 0, i32 0),
+ i8* getelementptr ([2 x i8]* @"\01LC3", i32 0, i32 0),
+ i8** byval %tmp, i8** byval %tmp1, i8** byval %tmp2)
+ ret i32 0
+}
+
+declare void @generate_password(i8** %pw, ...) nounwind