summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-12-03 20:46:59 +0000
committerReid Kleckner <rnk@google.com>2015-12-03 20:46:59 +0000
commit93fc520339d12954f9f71a899e6ea8986eb67d2f (patch)
tree1da0485540ddbe1bdd5b2ff2eb5cd3e98d9019e5 /llvm/test/CodeGen
parent69a372dc504c3a5bc53df96f1c236f47534e1e2d (diff)
downloadbcm5719-llvm-93fc520339d12954f9f71a899e6ea8986eb67d2f.tar.gz
bcm5719-llvm-93fc520339d12954f9f71a899e6ea8986eb67d2f.zip
[X86] Put no-op ADJCALLSTACK markers around all dynamic lowerings
Summary: These ADJCALLSTACK markers don't generate code, but they keep dynamic alloca code that calls chkstk out of the prologue. This slightly pessimizes inalloca calls by preventing some register copy coalescing, but I can live with that. Reviewers: qcolombet Subscribers: hans, llvm-commits Differential Revision: http://reviews.llvm.org/D15200 llvm-svn: 254645
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/X86/inalloca-stdcall.ll5
-rw-r--r--llvm/test/CodeGen/X86/inalloca.ll15
-rw-r--r--llvm/test/CodeGen/X86/shrink-wrap-chkstk.ll37
3 files changed, 49 insertions, 8 deletions
diff --git a/llvm/test/CodeGen/X86/inalloca-stdcall.ll b/llvm/test/CodeGen/X86/inalloca-stdcall.ll
index e5f6ea70e9c..4f7e4092a99 100644
--- a/llvm/test/CodeGen/X86/inalloca-stdcall.ll
+++ b/llvm/test/CodeGen/X86/inalloca-stdcall.ll
@@ -14,8 +14,9 @@ define void @g() {
%f2 = getelementptr %Foo, %Foo* %b, i32 0, i32 1
store i32 13, i32* %f1
store i32 42, i32* %f2
-; CHECK: movl $13, (%esp)
-; CHECK: movl $42, 4(%esp)
+; CHECK: movl %esp, %eax
+; CHECK: movl $13, (%eax)
+; CHECK: movl $42, 4(%eax)
call x86_stdcallcc void @f(%Foo* inalloca %b)
; CHECK: calll _f@8
; CHECK-NOT: %esp
diff --git a/llvm/test/CodeGen/X86/inalloca.ll b/llvm/test/CodeGen/X86/inalloca.ll
index 904366219ab..e523c945a69 100644
--- a/llvm/test/CodeGen/X86/inalloca.ll
+++ b/llvm/test/CodeGen/X86/inalloca.ll
@@ -14,8 +14,9 @@ entry:
%f2 = getelementptr %Foo, %Foo* %b, i32 0, i32 1
store i32 13, i32* %f1
store i32 42, i32* %f2
-; CHECK: movl $13, (%esp)
-; CHECK: movl $42, 4(%esp)
+; CHECK: movl %esp, %eax
+; CHECK: movl $13, (%eax)
+; CHECK: movl $42, 4(%eax)
call void @f(%Foo* inalloca %b)
; CHECK: calll _f
ret void
@@ -33,8 +34,9 @@ entry:
%f2 = getelementptr %Foo, %Foo* %b, i32 0, i32 1
store i32 13, i32* %f1
store i32 42, i32* %f2
-; CHECK: movl $13, (%esp)
-; CHECK: movl $42, 4(%esp)
+; CHECK: movl %esp, %eax
+; CHECK: movl $13, (%eax)
+; CHECK: movl $42, 4(%eax)
call void @inreg_with_inalloca(i32 inreg 1, %Foo* inalloca %b)
; CHECK: movl $1, %eax
; CHECK: calll _inreg_with_inalloca
@@ -53,8 +55,9 @@ entry:
%f2 = getelementptr %Foo, %Foo* %b, i32 0, i32 1
store i32 13, i32* %f1
store i32 42, i32* %f2
-; CHECK-DAG: movl $13, (%esp)
-; CHECK-DAG: movl $42, 4(%esp)
+; CHECK: movl %esp, %eax
+; CHECK-DAG: movl $13, (%eax)
+; CHECK-DAG: movl $42, 4(%eax)
call x86_thiscallcc void @thiscall_with_inalloca(i8* null, %Foo* inalloca %b)
; CHECK-DAG: xorl %ecx, %ecx
; CHECK: calll _thiscall_with_inalloca
diff --git a/llvm/test/CodeGen/X86/shrink-wrap-chkstk.ll b/llvm/test/CodeGen/X86/shrink-wrap-chkstk.ll
new file mode 100644
index 00000000000..c0b2b45e676
--- /dev/null
+++ b/llvm/test/CodeGen/X86/shrink-wrap-chkstk.ll
@@ -0,0 +1,37 @@
+; RUN: llc < %s -enable-shrink-wrap=true | FileCheck %s
+
+; chkstk cannot come before the usual prologue, since it adjusts ESP.
+
+target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
+target triple = "i686-pc-windows-msvc18.0.0"
+
+%struct.S = type { [12 x i8] }
+
+define x86_thiscallcc void @call_inalloca(i1 %x) {
+entry:
+ %argmem = alloca inalloca <{ %struct.S }>, align 4
+ %argidx1 = getelementptr inbounds <{ %struct.S }>, <{ %struct.S }>* %argmem, i32 0, i32 0, i32 0, i32 0
+ %argidx2 = getelementptr inbounds <{ %struct.S }>, <{ %struct.S }>* %argmem, i32 0, i32 0, i32 0, i32 1
+ store i8 42, i8* %argidx2, align 4
+ br i1 %x, label %bb1, label %bb2
+
+bb1:
+ store i8 42, i8* %argidx1, align 4
+ br label %bb2
+
+bb2:
+ call void @inalloca_params(<{ %struct.S }>* inalloca nonnull %argmem)
+ ret void
+}
+
+; CHECK-LABEL: _call_inalloca: # @call_inalloca
+; CHECK: pushl %ebp
+; CHECK: movl %esp, %ebp
+; CHECK: movl $12, %eax
+; CHECK: calll __chkstk
+; CHECK: calll _inalloca_params
+; CHECK: movl %ebp, %esp
+; CHECK: popl %ebp
+; CHECK: retl
+
+declare void @inalloca_params(<{ %struct.S }>* inalloca)
OpenPOWER on IntegriCloud