1 # RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \
2 # RUN: -stop-after=prologepilog | FileCheck %s
3 # Check multiple epilogues, save_reg, save_reg_x.
5 # CHECK-LABEL: bb.0.entry:
6 # CHECK: early-clobber $sp = frame-setup STRXpre killed $x28, $sp, -32
7 # CHECK-NEXT: frame-setup SEH_SaveReg_X 28, -32
8 # CHECK-NEXT: frame-setup STRXui killed $x19, $sp, 1
9 # CHECK-NEXT: frame-setup SEH_SaveReg 19, 8
10 # CHECK-NEXT: frame-setup STRXui killed $lr, $sp, 2
11 # CHECK-NEXT: frame-setup SEH_SaveReg 30, 16
12 # CHECK-NEXT: $sp = frame-setup SUBXri $sp, 496, 0
13 # CHECK-NEXT: frame-setup SEH_StackAlloc 496
14 # CHECK-NEXT: frame-setup SEH_PrologEnd
16 # CHECK-LABEL: bb.1.if.then:
17 # CHECK: frame-destroy SEH_EpilogStart
18 # CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 496, 0
19 # CHECK-NEXT: frame-destroy SEH_StackAlloc 496
20 # CHECK-NEXT: $lr = frame-destroy LDRXui $sp, 2
21 # CHECK-NEXT: frame-destroy SEH_SaveReg 30, 16
22 # CHECK-NEXT: $x19 = frame-destroy LDRXui $sp, 1
23 # CHECK-NEXT: frame-destroy SEH_SaveReg 19, 8
24 # CHECK-NEXT: early-clobber $sp, $x28 = frame-destroy LDRXpost $sp, 32
25 # CHECK-NEXT: frame-destroy SEH_SaveReg_X 28, -32
26 # CHECK-NEXT: frame-destroy SEH_EpilogEnd
27 # CHECK-NEXT: TCRETURNdi @"?func2@@YAHXZ", 0, csr_aarch64_aapcs, implicit $sp
31 target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
32 target triple = "aarch64-unknown-windows-msvc19.11.0"
34 define dso_local i32 @"?func@@YAHH@Z"(i32 %i) local_unnamed_addr #0 {
36 %B = alloca [123 x i32], align 4
37 %call = tail call i32 @"?func2@@YAHXZ"()
38 %cmp = icmp sgt i32 %i, 2
39 br i1 %cmp, label %if.then, label %if.else
41 if.then: ; preds = %entry
42 %call1 = tail call i32 @"?func2@@YAHXZ"()
45 if.else: ; preds = %entry
46 %0 = bitcast [123 x i32]* %B to i8*
47 call void @llvm.lifetime.start.p0i8(i64 492, i8* nonnull %0) #3
48 %arraydecay7 = bitcast [123 x i32]* %B to i32*
49 %call2 = call i32 @"?func3@@YAHPEAH@Z"(i32* nonnull %arraydecay7)
50 call void @llvm.lifetime.end.p0i8(i64 492, i8* nonnull %0) #3
54 ; Function Attrs: argmemonly nounwind
55 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
57 declare dso_local i32 @"?func2@@YAHXZ"() local_unnamed_addr #2
59 declare dso_local i32 @"?func3@@YAHPEAH@Z"(i32*) local_unnamed_addr #2
61 ; Function Attrs: argmemonly nounwind
62 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
64 ; Function Attrs: nounwind
65 declare void @llvm.stackprotector(i8*, i8**) #3
67 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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" }
68 attributes #1 = { argmemonly nounwind }
69 attributes #2 = { "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" }
70 attributes #3 = { nounwind }
76 exposesReturnsTwice: false
78 regBankSelected: false
81 tracksRegLiveness: true
85 - { reg: '$w0', virtual-reg: '' }
87 isFrameAddressTaken: false
88 isReturnAddressTaken: false
98 cvBytesOfCalleeSavedRegisters: 0
99 hasOpaqueSPAdjustment: false
101 hasMustTailInVarArgFunc: false
107 - { id: 0, name: B, type: default, offset: 0, size: 492, alignment: 4,
108 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
109 local-offset: -492, debug-info-variable: '', debug-info-expression: '',
110 debug-info-location: '' }
114 successors: %bb.1(0x40000000), %bb.2(0x40000000)
117 renamable $w19 = COPY $w0
118 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
119 BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
120 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
121 dead $wzr = SUBSWri killed renamable $w19, 3, 0, implicit-def $nzcv
122 Bcc 11, %bb.2, implicit killed $nzcv
126 TCRETURNdi @"?func2@@YAHXZ", 0, csr_aarch64_aapcs, implicit $sp
129 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
130 $x0 = ADDXri %stack.0.B, 0, 0
131 BL @"?func3@@YAHPEAH@Z", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit-def $sp, implicit-def $w0
132 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
133 RET_ReallyLR implicit $w0