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. 4 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 13 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 24 25 26--- | 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" 29 30 define dso_local i32 @"?func@@YAHH@Z"(i32 %i) local_unnamed_addr #0 { 31 entry: 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 36 37 if.then: ; preds = %entry 38 %call1 = tail call i32 @"?func2@@YAHXZ"() 39 ret i32 %call1 40 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 47 ret i32 %call2 48 } 49 50 ; Function Attrs: argmemonly nounwind 51 declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1 52 53 declare dso_local i32 @"?func2@@YAHXZ"() local_unnamed_addr #2 54 55 declare dso_local i32 @"?func3@@YAHPEAH@Z"(ptr) local_unnamed_addr #2 56 57 ; Function Attrs: argmemonly nounwind 58 declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1 59 60 ; Function Attrs: nounwind 61 declare void @llvm.stackprotector(ptr, ptr) #3 62 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 } 67 68... 69--- 70name: '?func@@YAHH@Z' 71alignment: 4 72exposesReturnsTwice: false 73legalized: false 74regBankSelected: false 75selected: false 76failedISel: false 77tracksRegLiveness: true 78hasWinCFI: false 79registers: 80liveins: 81 - { reg: '$w0', virtual-reg: '' } 82frameInfo: 83 isFrameAddressTaken: false 84 isReturnAddressTaken: false 85 hasStackMap: false 86 hasPatchPoint: false 87 stackSize: 0 88 offsetAdjustment: 0 89 maxAlignment: 4 90 adjustsStack: true 91 hasCalls: true 92 stackProtector: '' 93 maxCallFrameSize: 0 94 cvBytesOfCalleeSavedRegisters: 0 95 hasOpaqueSPAdjustment: false 96 hasVAStart: false 97 hasMustTailInVarArgFunc: false 98 localFrameSize: 492 99 savePoint: '' 100 restorePoint: '' 101fixedStack: 102stack: 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: '' } 107constants: 108body: | 109 bb.0.entry: 110 successors: %bb.1(0x40000000), %bb.2(0x40000000) 111 liveins: $w0 112 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 119 B %bb.1 120 121 bb.1.if.then: 122 TCRETURNdi @"?func2@@YAHXZ", 0, csr_aarch64_aapcs, implicit $sp 123 124 bb.2.if.else: 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 130 131... 132