190 lines · plain
1# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \2# RUN: -stop-after=prologepilog | FileCheck %s3# Test that stack probe results in Nop unwind codes in the prologue. Test4# save_fplr, save_reg_x and stack_alloc with multiple updates.5 6# CHECK: early-clobber $sp = frame-setup STRXpre killed $x28, $sp, -327# CHECK-NEXT: frame-setup SEH_SaveReg_X 28, -328# CHECK-NEXT: frame-setup STPXi killed $fp, killed $lr, $sp, 19# CHECK-NEXT: frame-setup SEH_SaveFPLR 810# CHECK-NEXT: $x15 = frame-setup MOVZXi 56009, 011# CHECK-NEXT: frame-setup SEH_Nop12# CHECK-NEXT: $x15 = frame-setup MOVKXi $x15, 2, 1613# CHECK-NEXT: frame-setup SEH_Nop14# CHECK-NEXT: frame-setup BL &__chkstk, implicit-def $lr, implicit $sp, implicit $x15, implicit-def dead $x16, implicit-def dead $x17, implicit-def dead $nzcv15# CHECK-NEXT: frame-setup SEH_Nop16# CHECK-NEXT: $sp = frame-setup SUBXrx64 killed $sp, killed $x15, 2817# CHECK-NEXT: frame-setup SEH_StackAlloc 299329618# CHECK-NEXT: frame-setup SEH_PrologEnd19# CHECK: frame-destroy SEH_EpilogStart20# CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 730, 1221# CHECK-NEXT: frame-destroy SEH_StackAlloc 299008022# CHECK-NEXT: $sp = frame-destroy ADDXri $sp, 3216, 023# CHECK-NEXT: frame-destroy SEH_StackAlloc 321624# CHECK-NEXT: $fp, $lr = frame-destroy LDPXi $sp, 125# CHECK-NEXT: frame-destroy SEH_SaveFPLR 826# CHECK-NEXT: early-clobber $sp, $x28 = frame-destroy LDRXpost $sp, 3227# CHECK-NEXT: frame-destroy SEH_SaveReg_X 28, -3228# CHECK-NEXT: frame-destroy SEH_EpilogEnd29# CHECK-NEXT: RET_ReallyLR implicit killed $w030--- |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"33 34 ; Function Attrs: noinline optnone35 define dso_local i32 @"?func@@YAHH@Z"(i32 %i) #0 {36 entry:37 %retval = alloca i32, align 438 %i.addr = alloca i32, align 439 %A = alloca [748193 x i32], align 440 %a = alloca i32, align 441 %B = alloca [123 x i32], align 442 store i32 %i, ptr %i.addr, align 443 %0 = load i32, ptr %i.addr, align 444 %add = add nsw i32 %0, 245 store i32 %add, ptr %a, align 446 %call = call i32 @"?func2@@YAHXZ"()47 %1 = load i32, ptr %i.addr, align 448 %cmp = icmp sgt i32 %1, 249 br i1 %cmp, label %if.then, label %if.else50 51 if.then: ; preds = %entry52 %call1 = call i32 @"?func2@@YAHXZ"()53 store i32 %call1, ptr %retval, align 454 br label %return55 56 if.else: ; preds = %entry57 %arraydecay = getelementptr inbounds [123 x i32], ptr %B, i32 0, i32 058 %call2 = call i32 @"?func3@@YAHPEAH@Z"(ptr %arraydecay)59 store i32 %call2, ptr %retval, align 460 br label %return61 62 return: ; preds = %if.else, %if.then63 %2 = load i32, ptr %retval, align 464 ret i32 %265 }66 67 declare dso_local i32 @"?func2@@YAHXZ"() #168 69 declare dso_local i32 @"?func3@@YAHPEAH@Z"(ptr) #170 71 ; Function Attrs: nounwind72 declare void @llvm.stackprotector(ptr, ptr) #273 74 attributes #0 = { noinline optnone "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" "use-soft-float"="false" }75 attributes #1 = { "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" "use-soft-float"="false" }76 attributes #2 = { nounwind }77 78...79---80name: '?func@@YAHH@Z'81alignment: 482exposesReturnsTwice: false83legalized: true84regBankSelected: true85selected: true86failedISel: false87tracksRegLiveness: true88hasWinCFI: false89registers:90liveins:91frameInfo:92 isFrameAddressTaken: false93 isReturnAddressTaken: false94 hasStackMap: false95 hasPatchPoint: false96 stackSize: 097 offsetAdjustment: 098 maxAlignment: 899 adjustsStack: true100 hasCalls: true101 stackProtector: ''102 maxCallFrameSize: 0103 cvBytesOfCalleeSavedRegisters: 0104 hasOpaqueSPAdjustment: false105 hasVAStart: false106 hasMustTailInVarArgFunc: false107 localFrameSize: 2993276108 savePoint: []109 restorePoint: []110fixedStack:111stack:112 - { id: 0, name: retval, type: default, offset: 0, size: 4, alignment: 4,113 stack-id: default, callee-saved-register: '', callee-saved-restored: true,114 local-offset: -4, debug-info-variable: '', debug-info-expression: '',115 debug-info-location: '' }116 - { id: 1, name: i.addr, type: default, offset: 0, size: 4, alignment: 4,117 stack-id: default, callee-saved-register: '', callee-saved-restored: true,118 local-offset: -8, debug-info-variable: '', debug-info-expression: '',119 debug-info-location: '' }120 - { id: 2, name: A, type: default, offset: 0, size: 2992772, alignment: 4,121 stack-id: default, callee-saved-register: '', callee-saved-restored: true,122 local-offset: -2992780, debug-info-variable: '', debug-info-expression: '',123 debug-info-location: '' }124 - { id: 3, name: a, type: default, offset: 0, size: 4, alignment: 4,125 stack-id: default, callee-saved-register: '', callee-saved-restored: true,126 local-offset: -2992784, debug-info-variable: '', debug-info-expression: '',127 debug-info-location: '' }128 - { id: 4, name: B, type: default, offset: 0, size: 492, alignment: 4,129 stack-id: default, callee-saved-register: '', callee-saved-restored: true,130 local-offset: -2993276, debug-info-variable: '', debug-info-expression: '',131 debug-info-location: '' }132 - { id: 5, name: '', type: spill-slot, offset: 0, size: 8, alignment: 8,133 stack-id: default, callee-saved-register: '', callee-saved-restored: true,134 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }135 - { id: 6, name: '', type: spill-slot, offset: 0, size: 4, alignment: 4,136 stack-id: default, callee-saved-register: '', callee-saved-restored: true,137 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }138constants:139body: |140 bb.1.entry:141 successors: %bb.2(0x40000000), %bb.3(0x40000000)142 liveins: $w0143 144 renamable $x8 = ADDXri %stack.1.i.addr, 0, 0145 renamable $w9 = MOVi32imm 2146 STRWui killed renamable $w0, renamable $x8, 0 :: (store (s32) into %ir.i.addr)147 renamable $w0 = LDRWui renamable $x8, 0 :: (load (s32) from %ir.i.addr)148 renamable $w0 = ADDWri killed renamable $w0, 2, 0149 STRWui killed renamable $w0, %stack.3.a, 0 :: (store (s32) into %ir.a)150 ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp151 STRXui killed $x8, %stack.5, 0 :: (store (s64) into %stack.5)152 STRWui killed $w9, %stack.6, 0 :: (store (s32) into %stack.6)153 BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def $w0154 ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp155 $x8 = LDRXui %stack.5, 0 :: (load (s64) from %stack.5)156 renamable $w9 = LDRWui killed renamable $x8, 0 :: (load (s32) from %ir.i.addr)157 $w10 = LDRWui %stack.6, 0 :: (load (s32) from %stack.6)158 $wzr = SUBSWrr killed renamable $w9, killed renamable $w10, implicit-def $nzcv159 renamable $w9 = CSINCWr $wzr, $wzr, 13, implicit $nzcv160 TBNZW killed renamable $w9, 0, %bb.2161 B %bb.3162 163 bb.2.if.then:164 successors: %bb.4(0x80000000)165 166 ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp167 BL @"?func2@@YAHXZ", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit-def $w0168 ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp169 $x8 = LDRXui %stack.5, 0 :: (load (s64) from %stack.5)170 STRWui killed renamable $w0, killed renamable $x8, 1 :: (store (s32) into %ir.retval)171 B %bb.4172 173 bb.3.if.else:174 successors: %bb.4(0x80000000)175 176 renamable $x8 = ADDXri %stack.4.B, 0, 0177 ADJCALLSTACKDOWN 0, 0, implicit-def $sp, implicit $sp178 $x0 = COPY killed renamable $x8179 BL @"?func3@@YAHPEAH@Z", csr_aarch64_aapcs, implicit-def $lr, implicit $sp, implicit killed $x0, implicit-def $w0180 ADJCALLSTACKUP 0, 0, implicit-def $sp, implicit $sp181 $x8 = LDRXui %stack.5, 0 :: (load (s64) from %stack.5)182 STRWui killed renamable $w0, killed renamable $x8, 1 :: (store (s32) into %ir.retval)183 184 bb.4.return:185 $x8 = LDRXui %stack.5, 0 :: (load (s64) from %stack.5)186 renamable $w0 = LDRWui killed renamable $x8, 1 :: (load (s32) from %ir.retval)187 RET_ReallyLR implicit killed $w0188 189...190