CodeGen peephole: fold redundant phys reg copies
[oota-llvm.git] / test / CodeGen / X86 / shrink-wrap-chkstk.ll
1 ; RUN: llc < %s -enable-shrink-wrap=true | FileCheck %s
2
3 ; chkstk cannot come before the usual prologue, since it adjusts ESP.
4
5 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
6 target triple = "i686-pc-windows-msvc18.0.0"
7
8 %struct.S = type { [12 x i8] }
9
10 define x86_thiscallcc void @call_inalloca(i1 %x) {
11 entry:
12   %argmem = alloca inalloca <{ %struct.S }>, align 4
13   %argidx1 = getelementptr inbounds <{ %struct.S }>, <{ %struct.S }>* %argmem, i32 0, i32 0, i32 0, i32 0
14   %argidx2 = getelementptr inbounds <{ %struct.S }>, <{ %struct.S }>* %argmem, i32 0, i32 0, i32 0, i32 1
15   store i8 42, i8* %argidx2, align 4
16   br i1 %x, label %bb1, label %bb2
17
18 bb1:
19   store i8 42, i8* %argidx1, align 4
20   br label %bb2
21
22 bb2:
23   call void @inalloca_params(<{ %struct.S }>* inalloca nonnull %argmem)
24   ret void
25 }
26
27 ; CHECK-LABEL: _call_inalloca: # @call_inalloca
28 ; CHECK: pushl %ebp
29 ; CHECK: movl %esp, %ebp
30 ; CHECK: movl $12, %eax
31 ; CHECK: calll __chkstk
32 ; CHECK: calll _inalloca_params
33 ; CHECK: movl %ebp, %esp
34 ; CHECK: popl %ebp
35 ; CHECK: retl
36
37 declare void @inalloca_params(<{ %struct.S }>* inalloca)