1 # RUN: llc -mtriple=i686-windows --run-pass="x86-cf-opt" %s -o - | FileCheck %s
5 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
6 target triple = "i686--windows-msvc"
8 %struct.s = type { i64 }
10 declare void @good(i32, i32, i32, i32)
12 declare void @struct(ptr byval(%struct.s), i32, i32, i32)
14 ; Function Attrs: optsize
15 define void @test9() #0 {
17 %p = alloca i32, align 4
18 %q = alloca i32, align 4
19 %s = alloca %struct.s, align 4
20 call void @good(i32 1, i32 2, i32 3, i32 4)
21 %pv = ptrtoint ptr %p to i32
22 %qv = ptrtoint ptr %q to i32
23 call void @struct(ptr byval(%struct.s) %s, i32 6, i32 %qv, i32 %pv)
27 ; Function Attrs: nounwind
28 declare void @llvm.stackprotector(ptr, ptr) #1
30 attributes #0 = { optsize }
31 attributes #1 = { nounwind }
36 # CHECK: ADJCALLSTACKDOWN32 16, 0, 16, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp
37 # CHECK-NEXT: PUSH32i 4, implicit-def $esp, implicit $esp
38 # CHECK-NEXT: PUSH32i 3, implicit-def $esp, implicit $esp
39 # CHECK-NEXT: PUSH32i 2, implicit-def $esp, implicit $esp
40 # CHECK-NEXT: PUSH32i 1, implicit-def $esp, implicit $esp
41 # CHECK-NEXT: CALLpcrel32 @good, csr_32, implicit $esp, implicit $ssp, implicit-def $esp, implicit-def $ssp
42 # CHECK-NEXT: ADJCALLSTACKUP32 16, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp
43 # CHECK-NEXT: ADJCALLSTACKDOWN32 20, 0, 20, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp
44 # CHECK-NEXT: %1:gr32 = MOV32rm %stack.2.s, 1, $noreg, 0, $noreg :: (load (s32) from %stack.2.s, align 8)
45 # CHECK-NEXT: %2:gr32 = MOV32rm %stack.2.s, 1, $noreg, 4, $noreg :: (load (s32) from %stack.2.s + 4)
46 # CHECK-NEXT: %4:gr32 = LEA32r %stack.0.p, 1, $noreg, 0, $noreg
47 # CHECK-NEXT: %5:gr32 = LEA32r %stack.1.q, 1, $noreg, 0, $noreg
48 # CHECK-NEXT: PUSH32r %4, implicit-def $esp, implicit $esp
49 # CHECK-NEXT: PUSH32r %5, implicit-def $esp, implicit $esp
50 # CHECK-NEXT: PUSH32i 6, implicit-def $esp, implicit $esp
51 # CHECK-NEXT: PUSH32r %2, implicit-def $esp, implicit $esp
52 # CHECK-NEXT: PUSH32r %1, implicit-def $esp, implicit $esp
53 # CHECK-NEXT: CALLpcrel32 @struct, csr_32, implicit $esp, implicit $ssp, implicit-def $esp, implicit-def $ssp
54 # CHECK-NEXT: ADJCALLSTACKUP32 20, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp
58 exposesReturnsTwice: false
60 regBankSelected: false
62 tracksRegLiveness: true
64 - { id: 0, class: gr32, preferred-register: '' }
65 - { id: 1, class: gr32, preferred-register: '' }
66 - { id: 2, class: gr32, preferred-register: '' }
67 - { id: 3, class: gr32, preferred-register: '' }
68 - { id: 4, class: gr32, preferred-register: '' }
69 - { id: 5, class: gr32, preferred-register: '' }
72 isFrameAddressTaken: false
73 isReturnAddressTaken: false
82 maxCallFrameSize: 4294967295
83 hasOpaqueSPAdjustment: false
85 hasMustTailInVarArgFunc: false
90 - { id: 0, name: p, type: default, offset: 0, size: 4, alignment: 4,
91 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
92 debug-info-variable: '', debug-info-expression: '',
93 debug-info-location: '' }
94 - { id: 1, name: q, type: default, offset: 0, size: 4, alignment: 4,
95 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
96 debug-info-variable: '', debug-info-expression: '',
97 debug-info-location: '' }
98 - { id: 2, name: s, type: default, offset: 0, size: 8, alignment: 8,
99 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
100 debug-info-variable: '', debug-info-expression: '',
101 debug-info-location: '' }
105 ADJCALLSTACKDOWN32 16, 0, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp
107 MOV32mi %0, 1, $noreg, 12, $noreg, 4 :: (store (s32) into stack + 12)
108 MOV32mi %0, 1, $noreg, 8, $noreg, 3 :: (store (s32) into stack + 8)
109 MOV32mi %0, 1, $noreg, 4, $noreg, 2 :: (store (s32) into stack + 4)
110 MOV32mi %0, 1, $noreg, 0, $noreg, 1 :: (store (s32) into stack)
111 CALLpcrel32 @good, csr_32, implicit $esp, implicit $ssp, implicit-def $esp, implicit-def $ssp
112 ADJCALLSTACKUP32 16, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp
113 ADJCALLSTACKDOWN32 20, 0, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp
114 %1 = MOV32rm %stack.2.s, 1, $noreg, 0, $noreg :: (load (s32) from %stack.2.s, align 8)
115 %2 = MOV32rm %stack.2.s, 1, $noreg, 4, $noreg :: (load (s32) from %stack.2.s + 4)
117 MOV32mr %3, 1, $noreg, 4, $noreg, killed %2 :: (store (s32))
118 MOV32mr %3, 1, $noreg, 0, $noreg, killed %1 :: (store (s32))
119 %4 = LEA32r %stack.0.p, 1, $noreg, 0, $noreg
120 MOV32mr %3, 1, $noreg, 16, $noreg, killed %4 :: (store (s32) into stack + 16)
121 %5 = LEA32r %stack.1.q, 1, $noreg, 0, $noreg
122 MOV32mr %3, 1, $noreg, 12, $noreg, killed %5 :: (store (s32) into stack + 12)
123 MOV32mi %3, 1, $noreg, 8, $noreg, 6 :: (store (s32) into stack + 8)
124 CALLpcrel32 @struct, csr_32, implicit $esp, implicit $ssp, implicit-def $esp, implicit-def $ssp,
125 ADJCALLSTACKUP32 20, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp