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 $x19, $sp, -32
7 # CHECK-NEXT: frame-setup SEH_SaveReg_X 19, -32
8 # CHECK-NEXT: frame-setup STPXi killed $fp, killed $lr, $sp, 1
9 # CHECK-NEXT: frame-setup SEH_SaveFPLR 8
10 # CHECK-NEXT: $sp = frame-setup SUBXri $sp, 496, 0
11 # CHECK-NEXT: frame-setup SEH_StackAlloc 496
12 # CHECK-NEXT: frame-setup SEH_PrologEnd
14 # CHECK-LABEL: bb.1.if.then:
15 # CHECK: frame-destroy SEH_EpilogStart
16 # CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 496, 0
17 # CHECK-NEXT: frame-destroy SEH_StackAlloc 496
18 # CHECK-NEXT: $fp, $lr = frame-destroy LDPXi $sp, 1
19 # CHECK-NEXT: frame-destroy SEH_SaveFPLR 8
20 # CHECK-NEXT: early-clobber $sp, $x19 = frame-destroy LDRXpost $sp, 32
21 # CHECK-NEXT: frame-destroy SEH_SaveReg_X 19, -32
22 # CHECK-NEXT: frame-destroy SEH_EpilogEnd
23 # CHECK-NEXT: TCRETURNdi @"?func2@@YAHXZ", 0, csr_aarch64_aapcs, implicit $sp
27 target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
28 target triple = "aarch64-unknown-windows-msvc19.11.0"
30 define dso_local i32 @"?func@@YAHH@Z"(i32 %i) local_unnamed_addr #0 {
32 %B = alloca [123 x i32], align 4
33 %call = tail call i32 @"?func2@@YAHXZ"()
34 %cmp = icmp sgt i32 %i, 2
35 br i1 %cmp, label %if.then, label %if.else
37 if.then: ; preds = %entry
38 %call1 = tail call i32 @"?func2@@YAHXZ"()
41 if.else: ; preds = %entry
42 %0 = bitcast ptr %B to ptr
43 call void @llvm.lifetime.start.p0(i64 492, ptr nonnull %0) #3
44 %arraydecay7 = bitcast ptr %B to ptr
45 %call2 = call i32 @"?func3@@YAHPEAH@Z"(ptr nonnull %arraydecay7)
46 call void @llvm.lifetime.end.p0(i64 492, ptr nonnull %0) #3
50 ; Function Attrs: argmemonly nounwind
51 declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1
53 declare dso_local i32 @"?func2@@YAHXZ"() local_unnamed_addr #2
55 declare dso_local i32 @"?func3@@YAHPEAH@Z"(ptr) local_unnamed_addr #2
57 ; Function Attrs: argmemonly nounwind
58 declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1
60 ; Function Attrs: nounwind
61 declare void @llvm.stackprotector(ptr, ptr) #3
63 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "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" }
64 attributes #1 = { argmemonly nounwind }
65 attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" }
66 attributes #3 = { nounwind }
72 exposesReturnsTwice: false
74 regBankSelected: false
77 tracksRegLiveness: true
81 - { reg: '$w0', virtual-reg: '' }
83 isFrameAddressTaken: false
84 isReturnAddressTaken: false
94 cvBytesOfCalleeSavedRegisters: 0
95 hasOpaqueSPAdjustment: false
97 hasMustTailInVarArgFunc: false
103 - { id: 0, name: B, type: default, offset: 0, size: 492, alignment: 4,
104 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
105 local-offset: -492, debug-info-variable: '', debug-info-expression: '',
106 debug-info-location: '' }
110 successors: %bb.1(0x40000000), %bb.2(0x40000000)
113 renamable $w19 = COPY $w0
114 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
115 BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $w0
116 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
117 dead $wzr = SUBSWri killed renamable $w19, 3, 0, implicit-def $nzcv
118 Bcc 11, %bb.2, implicit killed $nzcv
122 TCRETURNdi @"?func2@@YAHXZ", 0, csr_aarch64_aapcs, implicit $sp
125 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
126 $x0 = ADDXri %stack.0.B, 0, 0
127 BL @"?func3@@YAHPEAH@Z", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit-def $sp, implicit-def $w0
128 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
129 RET_ReallyLR implicit $w0