1 # RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog \
2 # RUN: -filetype=obj | llvm-readobj --unwind | FileCheck %s
4 # Check that that the large stack allocation is correctly represented in .xdata.
6 # CHECK: ExceptionData {
7 # CHECK-NEXT: FunctionLength: 156
8 # CHECK-NEXT: Version: 0
9 # CHECK-NEXT: ExceptionData: No
10 # CHECK-NEXT: EpiloguePacked: No
11 # CHECK-NEXT: EpilogueScopes: 1
12 # CHECK-NEXT: ByteCodeLength: 20
13 # CHECK-NEXT: Prologue [
14 # CHECK-NEXT: 0xe002dac9 ; sub sp, #2993296
15 # CHECK-NEXT: 0xe3 ; nop
16 # CHECK-NEXT: 0xe3 ; nop
17 # CHECK-NEXT: 0x42 ; stp x29, x30, [sp, #16]
18 # CHECK-NEXT: 0xd53f ; str x28, [sp, #256]!
19 # CHECK-NEXT: 0xe4 ; end
21 # CHECK-NEXT: EpilogueScopes [
22 # CHECK-NEXT: EpilogueScope {
23 # CHECK-NEXT: StartOffset: 34
24 # CHECK-NEXT: EpilogueStartIndex: 10
25 # CHECK-NEXT: Opcodes [
26 # CHECK-NEXT: 0xe002da00 ; add sp, #2990080
27 # CHECK-NEXT: 0xc0c9 ; add sp, #3216
28 # CHECK-NEXT: 0x42 ; ldp x29, x30, [sp, #16]
29 # CHECK-NEXT: 0xd53f ; ldr x28, [sp], #256
30 # CHECK-NEXT: 0xe4 ; end
38 target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
39 target triple = "aarch64-unknown-windows-msvc19.11.0"
41 ; Function Attrs: noinline optnone
42 define dso_local i32 @"?func@@YAHH@Z"(i32 %i) #0 {
44 %retval = alloca i32, align 4
45 %i.addr = alloca i32, align 4
46 %A = alloca [748193 x i32], align 4
47 %a = alloca i32, align 4
48 %B = alloca [123 x i32], align 4
49 store i32 %i, i32* %i.addr, align 4
50 %0 = load i32, i32* %i.addr, align 4
51 %add = add nsw i32 %0, 2
52 store i32 %add, i32* %a, align 4
53 %call = call i32 @"?func2@@YAHXZ"()
54 %1 = load i32, i32* %i.addr, align 4
55 %cmp = icmp sgt i32 %1, 2
56 br i1 %cmp, label %if.then, label %if.else
58 if.then: ; preds = %entry
59 %call1 = call i32 @"?func2@@YAHXZ"()
60 store i32 %call1, i32* %retval, align 4
63 if.else: ; preds = %entry
64 %arraydecay = getelementptr inbounds [123 x i32], [123 x i32]* %B, i32 0, i32 0
65 %call2 = call i32 @"?func3@@YAHPEAH@Z"(i32* %arraydecay)
66 store i32 %call2, i32* %retval, align 4
69 return: ; preds = %if.else, %if.then
70 %2 = load i32, i32* %retval, align 4
74 declare dso_local i32 @"?func2@@YAHXZ"() #1
76 declare dso_local i32 @"?func3@@YAHPEAH@Z"(i32*) #1
78 ; Function Attrs: nounwind
79 declare void @llvm.stackprotector(i8*, i8**) #2
81 attributes #0 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
82 attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
83 attributes #2 = { nounwind }
85 !llvm.module.flags = !{!0}
87 !0 = !{i32 1, !"wchar_size", i32 2}
93 exposesReturnsTwice: false
98 tracksRegLiveness: true
103 isFrameAddressTaken: false
104 isReturnAddressTaken: false
114 hasOpaqueSPAdjustment: false
116 hasMustTailInVarArgFunc: false
117 localFrameSize: 2993276
122 - { id: 0, name: retval, type: default, offset: -36, size: 4, alignment: 4,
123 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
124 local-offset: -4, debug-info-variable: '', debug-info-expression: '',
125 debug-info-location: '' }
126 - { id: 1, name: i.addr, type: default, offset: -40, size: 4, alignment: 4,
127 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
128 local-offset: -8, debug-info-variable: '', debug-info-expression: '',
129 debug-info-location: '' }
130 - { id: 2, name: A, type: default, offset: -2992812, size: 2992772, alignment: 4,
131 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
132 local-offset: -2992780, debug-info-variable: '', debug-info-expression: '',
133 debug-info-location: '' }
134 - { id: 3, name: a, type: default, offset: -2992816, size: 4, alignment: 4,
135 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
136 local-offset: -2992784, debug-info-variable: '', debug-info-expression: '',
137 debug-info-location: '' }
138 - { id: 4, name: B, type: default, offset: -2993308, size: 492, alignment: 4,
139 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
140 local-offset: -2993276, debug-info-variable: '', debug-info-expression: '',
141 debug-info-location: '' }
142 - { id: 5, name: '', type: spill-slot, offset: -2993320, size: 8, alignment: 8,
143 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
144 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
145 - { id: 6, name: '', type: spill-slot, offset: -2993324, size: 4, alignment: 4,
146 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
147 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
148 - { id: 7, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
149 stack-id: default, callee-saved-register: '$fp', callee-saved-restored: true,
150 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
151 - { id: 8, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
152 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true,
153 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
154 - { id: 9, name: '', type: spill-slot, offset: -32, size: 8, alignment: 16,
155 stack-id: default, callee-saved-register: '$x28', callee-saved-restored: true,
156 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
160 successors: %bb.2(0x40000000), %bb.3(0x40000000)
161 liveins: $w0, $x28, $fp, $lr
163 early-clobber $sp = frame-setup STRXpre killed $x28, $sp, -32 :: (store 8 into %stack.9)
164 frame-setup SEH_SaveReg_X 28, -256
165 frame-setup STPXi killed $fp, killed $lr, $sp, 2 :: (store 8 into %stack.7), (store 8 into %stack.8)
166 frame-setup SEH_SaveFPLR 16
167 $x15 = frame-setup MOVi64imm 187081
169 frame-setup BL &__chkstk, implicit-def $lr, implicit $sp, implicit $x15
171 $sp = frame-setup SUBXrx64 killed $sp, killed $x15, 28
172 frame-setup SEH_StackAlloc 2993296
173 frame-setup SEH_PrologEnd
174 $x8 = ADDXri $sp, 730, 12
175 $x8 = ADDXri $x8, 3208, 0
176 renamable $w9 = MOVi32imm 2
177 STRWui killed renamable $w0, renamable $x8, 0 :: (store 4 into %ir.i.addr)
178 renamable $w0 = LDRWui renamable $x8, 0 :: (load 4 from %ir.i.addr)
179 renamable $w0 = ADDWri killed renamable $w0, 2, 0
180 STRWui killed renamable $w0, $sp, 128 :: (store 4 into %ir.a)
181 STRXui killed $x8, $sp, 1 :: (store 8 into %stack.5)
182 STRWui killed $w9, $sp, 1 :: (store 4 into %stack.6)
183 BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def $w0
184 $x8 = LDRXui $sp, 1 :: (load 8 from %stack.5)
185 renamable $w9 = LDRWui killed renamable $x8, 0 :: (load 4 from %ir.i.addr)
186 $w10 = LDRWui $sp, 1 :: (load 4 from %stack.6)
187 $wzr = SUBSWrr killed renamable $w9, killed renamable $w10, implicit-def $nzcv
188 renamable $w9 = CSINCWr $wzr, $wzr, 13, implicit $nzcv
189 TBNZW killed renamable $w9, 0, %bb.2
193 successors: %bb.4(0x80000000)
195 BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def $w0
196 $x8 = LDRXui $sp, 1 :: (load 8 from %stack.5)
197 STRWui killed renamable $w0, killed renamable $x8, 1 :: (store 4 into %ir.retval)
201 successors: %bb.4(0x80000000)
203 $x8 = ADDXri $sp, 20, 0
204 $x0 = COPY killed renamable $x8
205 BL @"?func3@@YAHPEAH@Z", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit killed $x0, implicit-def $w0
206 $x8 = LDRXui $sp, 1 :: (load 8 from %stack.5)
207 STRWui killed renamable $w0, killed renamable $x8, 1 :: (store 4 into %ir.retval)
210 $x8 = LDRXui $sp, 1 :: (load 8 from %stack.5)
211 renamable $w0 = LDRWui killed renamable $x8, 1 :: (load 4 from %ir.retval)
212 frame-destroy SEH_EpilogStart
213 $sp = frame-destroy ADDXri $sp, 730, 12
214 frame-destroy SEH_StackAlloc 2990080
215 $sp = frame-destroy ADDXri $sp, 3216, 0
216 frame-destroy SEH_StackAlloc 3216
217 $fp, $lr = frame-destroy LDPXi $sp, 2 :: (load 8 from %stack.7), (load 8 from %stack.8)
218 frame-destroy SEH_SaveFPLR 16
219 early-clobber $sp, $x28 = frame-destroy LDRXpost $sp, 32 :: (load 8 from %stack.9)
220 frame-destroy SEH_SaveReg_X 28, -256
221 frame-destroy SEH_EpilogEnd
222 RET_ReallyLR implicit killed $w0