aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-08-22 21:59:26 +0000
committerReid Kleckner <reid@kleckner.net>2014-08-22 21:59:26 +0000
commitd89c0abc0724945e3181f3aaef023b292e53baad (patch)
tree94a98cad9095854e12917f75215122f82f1b47a8 /test/CodeGen
parente5e847a500ef0726f343a3f69492026de54fb4c2 (diff)
ARM / x86_64 varargs: Don't save regparms in prologue without va_start
There's no need to do this if the user doesn't call va_start. In the future, we're going to have thunks that forward these register parameters with musttail calls, and they won't need these spills for handling va_start. Most of the test suite changes are adding va_start calls to existing tests to keep things working. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/ARM/fold-stack-adjust.ll3
-rw-r--r--test/CodeGen/ARM/thumb1_return_sequence.ll7
-rw-r--r--test/CodeGen/ARM/vararg_no_start.ll10
-rw-r--r--test/CodeGen/ARM/vargs_align.ll3
-rw-r--r--test/CodeGen/Thumb/pop.ll6
-rw-r--r--test/CodeGen/Thumb2/2009-08-06-SpDecBug.ll3
-rw-r--r--test/CodeGen/X86/vararg_no_start.ll9
-rw-r--r--test/CodeGen/X86/vastart-defs-eflags.ll2
8 files changed, 40 insertions, 3 deletions
diff --git a/test/CodeGen/ARM/fold-stack-adjust.ll b/test/CodeGen/ARM/fold-stack-adjust.ll
index 1d10464017c..514d4a9fccb 100644
--- a/test/CodeGen/ARM/fold-stack-adjust.ll
+++ b/test/CodeGen/ARM/fold-stack-adjust.ll
@@ -183,6 +183,7 @@ define void @test_varsize(...) minsize {
; CHECK: bx lr
%var = alloca i8, i32 8
+ call void @llvm.va_start(i8* %var)
call void @bar(i8* %var)
ret void
}
@@ -216,3 +217,5 @@ if.then: ; preds = %entry
exit: ; preds = %if.then, %entry
ret float %call1
}
+
+declare void @llvm.va_start(i8*) nounwind
diff --git a/test/CodeGen/ARM/thumb1_return_sequence.ll b/test/CodeGen/ARM/thumb1_return_sequence.ll
index ab08379a248..318e6e40237 100644
--- a/test/CodeGen/ARM/thumb1_return_sequence.ll
+++ b/test/CodeGen/ARM/thumb1_return_sequence.ll
@@ -46,6 +46,7 @@ entry:
store <4 x i32> <i32 42, i32 42, i32 42, i32 42>, <4 x i32>* %b, align 16
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %a, align 16
%0 = load <4 x i32>* %a, align 16
+ call void @llvm.va_start(i8* null)
ret <4 x i32> %0
; Epilogue
@@ -154,6 +155,7 @@ entry:
%7 = load i32* %d, align 4
%add5 = add nsw i32 %add4, %7
%add6 = add nsw i32 %add5, %i
+ call void @llvm.va_start(i8* null)
ret i32 %add6
; Epilogue
@@ -198,7 +200,8 @@ entry:
; CHECK-V5T: sub sp,
; CHECK-V5T: push {[[SAVED:(r[4567](, )?)+]], lr}
- ret i32 %i;
+ call void @llvm.va_start(i8* null)
+ ret i32 %i;
; Epilogue
; --------
; CHECK-V4T: pop {[[SAVED]]}
@@ -210,3 +213,5 @@ entry:
; CHECK-V5T-NEXT: add sp,
; CHECK-V5T-NEXT: bx r3
}
+
+declare void @llvm.va_start(i8*) nounwind
diff --git a/test/CodeGen/ARM/vararg_no_start.ll b/test/CodeGen/ARM/vararg_no_start.ll
new file mode 100644
index 00000000000..f9c8c1b7546
--- /dev/null
+++ b/test/CodeGen/ARM/vararg_no_start.ll
@@ -0,0 +1,10 @@
+; RUN: llc -mtriple=arm-darwin < %s | FileCheck %s
+; RUN: llc -O0 -mtriple=arm-darwin < %s | FileCheck %s
+
+define void @foo(i8*, ...) {
+ ret void
+}
+; CHECK-LABEL: {{^_?}}foo:
+; CHECK-NOT: str
+; CHECK: {{bx lr|mov pc, lr}}
+declare void @llvm.va_start(i8*) nounwind
diff --git a/test/CodeGen/ARM/vargs_align.ll b/test/CodeGen/ARM/vargs_align.ll
index e390cf05144..3abb57ee51f 100644
--- a/test/CodeGen/ARM/vargs_align.ll
+++ b/test/CodeGen/ARM/vargs_align.ll
@@ -10,6 +10,7 @@ entry:
store i32 0, i32* %tmp
%tmp1 = load i32* %tmp ; <i32> [#uses=1]
store i32 %tmp1, i32* %retval
+ call void @llvm.va_start(i8* null)
br label %return
return: ; preds = %entry
@@ -20,3 +21,5 @@ return: ; preds = %entry
; OABI: add sp, sp, #12
; OABI: add sp, sp, #12
}
+
+declare void @llvm.va_start(i8*) nounwind
diff --git a/test/CodeGen/Thumb/pop.ll b/test/CodeGen/Thumb/pop.ll
index 1e45c7f37bc..3c539c69017 100644
--- a/test/CodeGen/Thumb/pop.ll
+++ b/test/CodeGen/Thumb/pop.ll
@@ -7,7 +7,9 @@ define void @t(i8* %a, ...) nounwind {
; CHECK-NEXT: add sp, #12
; CHECK-NEXT: bx r3
entry:
- %a.addr = alloca i8*
- store i8* %a, i8** %a.addr
+ %a.addr = alloca i8, i32 4
+ call void @llvm.va_start(i8* %a.addr)
ret void
}
+
+declare void @llvm.va_start(i8*) nounwind
diff --git a/test/CodeGen/Thumb2/2009-08-06-SpDecBug.ll b/test/CodeGen/Thumb2/2009-08-06-SpDecBug.ll
index c8eac8d4d09..59c23673211 100644
--- a/test/CodeGen/Thumb2/2009-08-06-SpDecBug.ll
+++ b/test/CodeGen/Thumb2/2009-08-06-SpDecBug.ll
@@ -13,6 +13,7 @@ entry:
; CHECK-NOT: mov sp, r7
; CHECK: add sp, #8
call void @__gcov_flush() nounwind
+ call void @llvm.va_start(i8* null)
br i1 undef, label %bb5, label %bb
bb: ; preds = %bb, %entry
@@ -27,3 +28,5 @@ bb5: ; preds = %bb, %entry
declare hidden void @__gcov_flush()
declare i32 @execvp(i8*, i8**) nounwind
+
+declare void @llvm.va_start(i8*) nounwind
diff --git a/test/CodeGen/X86/vararg_no_start.ll b/test/CodeGen/X86/vararg_no_start.ll
new file mode 100644
index 00000000000..ab5c6fc58aa
--- /dev/null
+++ b/test/CodeGen/X86/vararg_no_start.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s
+
+define void @foo(i8*, ...) {
+ ret void
+}
+; CHECK-LABEL: {{^_?}}foo:
+; CHECK-NOT: movq
+; CHECK: retq
diff --git a/test/CodeGen/X86/vastart-defs-eflags.ll b/test/CodeGen/X86/vastart-defs-eflags.ll
index 6017753fc8f..d0c515089f4 100644
--- a/test/CodeGen/X86/vastart-defs-eflags.ll
+++ b/test/CodeGen/X86/vastart-defs-eflags.ll
@@ -14,6 +14,7 @@ entry:
br i1 %tobool, label %if.end, label %if.then
if.then: ; preds = %entry
+ call void @llvm.va_start(i8* null)
br label %if.end
if.end: ; preds = %entry, %if.then
@@ -21,3 +22,4 @@ if.end: ; preds = %entry, %if.then
ret i32 %hasflag
}
+declare void @llvm.va_start(i8*) nounwind