• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -mtriple=i686-windows --run-pass="x86-cf-opt" %s -o - | FileCheck %s
2
3# PR34903
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--windows-msvc"
7
8  %struct.s = type { i64 }
9
10  declare void @good(i32, i32, i32, i32)
11
12  declare void @struct(%struct.s* byval, i32, i32, i32)
13
14  ; Function Attrs: optsize
15  define void @test9() #0 {
16  entry:
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 i32* %p to i32
22    %qv = ptrtoint i32* %q to i32
23    call void @struct(%struct.s* byval %s, i32 6, i32 %qv, i32 %pv)
24    ret void
25  }
26
27  ; Function Attrs: nounwind
28  declare void @llvm.stackprotector(i8*, i8**) #1
29
30  attributes #0 = { optsize }
31  attributes #1 = { nounwind }
32
33...
34---
35# CHECK-LABEL: test9
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: PUSH32i8 4, implicit-def $esp, implicit $esp
38# CHECK-NEXT: PUSH32i8 3, implicit-def $esp, implicit $esp
39# CHECK-NEXT: PUSH32i8 2, implicit-def $esp, implicit $esp
40# CHECK-NEXT: PUSH32i8 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 4 from %stack.2.s, align 8)
45# CHECK-NEXT: %2:gr32 = MOV32rm %stack.2.s, 1, $noreg, 4, $noreg :: (load 4 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: PUSH32i8 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
55# CHECK-NEXT: RET 0
56name:            test9
57alignment:       0
58exposesReturnsTwice: false
59legalized:       false
60regBankSelected: false
61selected:        false
62tracksRegLiveness: true
63registers:
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: '' }
70liveins:
71frameInfo:
72  isFrameAddressTaken: false
73  isReturnAddressTaken: false
74  hasStackMap:     false
75  hasPatchPoint:   false
76  stackSize:       0
77  offsetAdjustment: 0
78  maxAlignment:    8
79  adjustsStack:    false
80  hasCalls:        true
81  stackProtector:  ''
82  maxCallFrameSize: 4294967295
83  hasOpaqueSPAdjustment: false
84  hasVAStart:      false
85  hasMustTailInVarArgFunc: false
86  savePoint:       ''
87  restorePoint:    ''
88fixedStack:
89stack:
90  - { id: 0, name: p, type: default, offset: 0, size: 4, alignment: 4,
91      stack-id: 0, 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: 0, 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: 0, callee-saved-register: '', callee-saved-restored: true,
100      debug-info-variable: '', debug-info-expression: '',
101      debug-info-location: '' }
102constants:
103body:             |
104  bb.0.entry:
105    ADJCALLSTACKDOWN32 16, 0, 0, implicit-def dead $esp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $esp, implicit $ssp
106    %0 = COPY $esp
107    MOV32mi %0, 1, $noreg, 12, $noreg, 4 :: (store 4 into stack + 12)
108    MOV32mi %0, 1, $noreg, 8, $noreg, 3 :: (store 4 into stack + 8)
109    MOV32mi %0, 1, $noreg, 4, $noreg, 2 :: (store 4 into stack + 4)
110    MOV32mi %0, 1, $noreg, 0, $noreg, 1 :: (store 4 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 4 from %stack.2.s, align 8)
115    %2 = MOV32rm %stack.2.s, 1, $noreg, 4, $noreg :: (load 4 from %stack.2.s + 4)
116    %3 = COPY $esp
117    MOV32mr %3, 1, $noreg, 4, $noreg, killed %2 :: (store 4)
118    MOV32mr %3, 1, $noreg, 0, $noreg, killed %1 :: (store 4)
119    %4 = LEA32r %stack.0.p, 1, $noreg, 0, $noreg
120    MOV32mr %3, 1, $noreg, 16, $noreg, killed %4 :: (store 4 into stack + 16)
121    %5 = LEA32r %stack.1.q, 1, $noreg, 0, $noreg
122    MOV32mr %3, 1, $noreg, 12, $noreg, killed %5 :: (store 4 into stack + 12)
123    MOV32mi %3, 1, $noreg, 8, $noreg, 6 :: (store 4 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
126    RET 0
127
128...
129