blob: 975fba11715751163f755b2b3f50a6b8dfeda977 [file] [log] [blame]
# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \
# RUN: -stop-after=prologepilog | FileCheck %s
# Test that stack probe results in Nop unwind codes in the prologue. Test
# save_fplr, save_reg_x and stack_alloc with multiple updates
# CHECK: early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -2
# CHECK-NEXT: frame-setup SEH_SaveFPLR_X -16
# CHECK-NEXT: $fp = frame-setup ADDXri $sp, 0, 0
# CHECK-NEXT: frame-setup SEH_SetFP
# CHECK-NEXT: $sp = frame-setup SUBXri $sp, 32, 0
# CHECK-NEXT: frame-setup SEH_StackAlloc 32
# CHECK-NEXT: frame-setup SEH_PrologEnd
# CHECK: frame-destroy SEH_EpilogStart
# CHECK-NEXT: $sp = frame-destroy ADDXri $fp, 0, 0
# CHECK-NEXT: frame-destroy SEH_SetFP
# CHECK-NEXT: early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2
# CHECK-NEXT: frame-destroy SEH_SaveFPLR_X -16
# CHECK-NEXT: frame-destroy SEH_EpilogEnd
# CHECK-NEXT: RET_ReallyLR implicit killed $w0
--- |
target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-windows-msvc19.11.0"
; Function Attrs: noinline optnone
define dso_local i32 @"?func@@YAHHHHH@Z"(i32 %n, i32 %idx, i32 %b, i32 %c) #0 {
entry:
%c.addr = alloca i32, align 4
%b.addr = alloca i32, align 4
%idx.addr = alloca i32, align 4
%n.addr = alloca i32, align 4
%a = alloca i32*, align 8
store i32 %c, i32* %c.addr, align 4
store i32 %b, i32* %b.addr, align 4
store i32 %idx, i32* %idx.addr, align 4
store i32 %n, i32* %n.addr, align 4
%0 = load i32, i32* %n.addr, align 4
%conv = sext i32 %0 to i64
%1 = alloca i8, i64 %conv, align 16
%2 = bitcast i8* %1 to i32*
store i32* %2, i32** %a, align 8
%3 = load i32*, i32** %a, align 8
call void @"?init@@YAXPEAH@Z"(i32* %3)
ret i32 0
}
declare dso_local void @"?init@@YAXPEAH@Z"(i32*) #1
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #2
attributes #0 = { noinline optnone "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" }
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" }
attributes #2 = { nounwind }
...
---
name: '?func@@YAHHHHH@Z'
alignment: 4
exposesReturnsTwice: false
legalized: false
regBankSelected: false
selected: false
failedISel: false
tracksRegLiveness: true
hasWinCFI: false
registers:
liveins:
- { reg: '$w0', virtual-reg: '' }
- { reg: '$w1', virtual-reg: '' }
- { reg: '$w2', virtual-reg: '' }
- { reg: '$w3', virtual-reg: '' }
frameInfo:
isFrameAddressTaken: false
isReturnAddressTaken: false
hasStackMap: false
hasPatchPoint: false
stackSize: 0
offsetAdjustment: 0
maxAlignment: 8
adjustsStack: true
hasCalls: true
stackProtector: ''
maxCallFrameSize: 0
cvBytesOfCalleeSavedRegisters: 0
hasOpaqueSPAdjustment: false
hasVAStart: false
hasMustTailInVarArgFunc: false
localFrameSize: 24
savePoint: ''
restorePoint: ''
fixedStack:
stack:
- { id: 0, name: c.addr, type: default, offset: 0, size: 4, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: -4, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
- { id: 1, name: b.addr, type: default, offset: 0, size: 4, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: -8, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
- { id: 2, name: idx.addr, type: default, offset: 0, size: 4, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: -12, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
- { id: 3, name: n.addr, type: default, offset: 0, size: 4, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: -16, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
- { id: 4, name: a, type: default, offset: 0, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: -24, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
- { id: 5, name: '', type: variable-sized, offset: 0,
alignment: 1, stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: -24, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
- { id: 6, name: '', type: spill-slot, offset: 0, size: 8, alignment: 8,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
constants:
body: |
bb.0.entry:
liveins: $w0, $w1, $w2, $w3
STRWui killed renamable $w3, %stack.0.c.addr, 0 :: (store 4 into %ir.c.addr)
STRWui killed renamable $w2, %stack.1.b.addr, 0 :: (store 4 into %ir.b.addr)
STRWui killed renamable $w1, %stack.2.idx.addr, 0 :: (store 4 into %ir.idx.addr)
STRWui killed renamable $w0, %stack.3.n.addr, 0 :: (store 4 into %ir.n.addr)
renamable $x8 = LDRSWui %stack.3.n.addr, 0 :: (dereferenceable load 4 from %ir.n.addr)
ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
renamable $x8 = nuw ADDXri killed renamable $x8, 15, 0
renamable $x8 = UBFMXri killed renamable $x8, 4, 63
$x15 = COPY renamable $x8
STRXui killed $x8, %stack.6, 0 :: (store 8 into %stack.6)
BL &__chkstk, csr_aarch64_stackprobe_windows, implicit-def dead $lr, implicit $sp, implicit killed $x15
renamable $x8 = COPY $sp
$x15 = LDRXui %stack.6, 0 :: (load 8 from %stack.6)
renamable $x8 = SUBSXrs killed renamable $x8, killed renamable $x15, 4, implicit-def dead $nzcv
$sp = COPY renamable $x8
ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
STRXui killed renamable $x8, %stack.4.a, 0 :: (store 8 into %ir.a)
renamable $x0 = LDRXui %stack.4.a, 0 :: (dereferenceable load 8 from %ir.a)
ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
BL @"?init@@YAXPEAH@Z", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp
ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
renamable $w1 = COPY $wzr
$w0 = COPY killed renamable $w1
RET_ReallyLR implicit killed $w0
...