-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test and new MFI serializations to support test
- Loading branch information
1 parent
cb1a106
commit 32e26ed
Showing
3 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# The change being tested here is that X86InstrInfo's getSPAdjust correctly handles POP/ADD instructions within | ||
# call sequences, as previously it assumed only PUSHes would be present for parameter passing. | ||
# What this test actually does is recreate a situation where: | ||
# - something other than a PUSH appears in a call sequence, and | ||
# - failing to recognize the SP adjustment by such an instruction actually changes something | ||
# observable. | ||
# | ||
# To this end, we create a situation where: | ||
# - the FP must be spilled around calls | ||
# - a frame object is stored before a call frame and loaded in the call frame | ||
# (emulating an argument restored from spill), following a call which POPs something | ||
# - call-frame pseudos can *not* be simplified early in prologepilog | ||
# | ||
# The issue being corrected is the case where prologepilog sees the SP adjustment of PUSHes only, and not | ||
# POP/ADD. This adjustment value can be carried over and incorrectly applied to frame offsets. So, | ||
# in the following we ensure that references to a frame object carry the same offset. | ||
# | ||
# NB: | ||
# FPClobberedByCall and hasPushSequence have to be supplied in the MFI section. The former | ||
# is required to force spill of the FP, and the latter ensures call-frame pseudos are not simplified. | ||
# | ||
# The csr_64_intel_ocl_bi_avx512 regmask is used to ensure that the FP is spilled. Other csr's may | ||
# acheive the same. | ||
# | ||
# RUN: llc -mtriple x86_64-unknown-linux-gnu -run-pass=prologepilog %s -o - | FileCheck %s | ||
--- | ||
name: f | ||
alignment: 16 | ||
exposesReturnsTwice: false | ||
legalized: false | ||
regBankSelected: false | ||
selected: false | ||
failedISel: false | ||
tracksRegLiveness: true | ||
hasWinCFI: false | ||
callsEHReturn: false | ||
callsUnwindInit: false | ||
hasEHCatchret: false | ||
hasEHScopes: false | ||
hasEHFunclets: false | ||
isOutlined: false | ||
debugInstrRef: true | ||
failsVerification: false | ||
tracksDebugUserValues: true | ||
registers: [] | ||
liveins: | ||
- { reg: '$rdi', virtual-reg: '' } | ||
- { reg: '$rsi', virtual-reg: '' } | ||
frameInfo: | ||
isFrameAddressTaken: false | ||
isReturnAddressTaken: false | ||
hasStackMap: false | ||
hasPatchPoint: false | ||
stackSize: 0 | ||
offsetAdjustment: 0 | ||
maxAlignment: 64 | ||
adjustsStack: true | ||
hasCalls: true | ||
stackProtector: '' | ||
functionContext: '' | ||
maxCallFrameSize: 4294967295 | ||
cvBytesOfCalleeSavedRegisters: 0 | ||
hasOpaqueSPAdjustment: false | ||
hasVAStart: false | ||
hasMustTailInVarArgFunc: false | ||
hasTailCall: false | ||
isCalleeSavedInfoValid: false | ||
localFrameSize: 0 | ||
savePoint: '' | ||
restorePoint: '' | ||
fixedStack: [] | ||
stack: | ||
- { id: 0, name: '', type: spill-slot, offset: 0, size: 64, | ||
alignment: 32, stack-id: default, callee-saved-register: '', callee-saved-restored: true, | ||
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } | ||
machineFunctionInfo: | ||
FPClobberedByCall: true | ||
hasPushSequences: true | ||
body: | | ||
bb.0: | ||
liveins: $rdi, $rsi | ||
MOV64mr %stack.0, 1, $noreg, 0, $noreg, renamable $rdi :: (store (s64) into %stack.0) | ||
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp | ||
CALL64r renamable undef $rsi, csr_64_intel_ocl_bi_avx512, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp | ||
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp | ||
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp | ||
$rax = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load (s64) from %stack.0) | ||
$rdi = COPY renamable $rax | ||
CALL64r renamable undef $rsi, csr_64_intel_ocl_bi_avx512, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp | ||
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp | ||
... | ||
# ensure the store and load to the frame object have matching offsets after resolution. | ||
# CHECK: MOV64mr $rsp, 1, $noreg, [[DISP:[1-9][0-9]+]] | ||
# CHECK: MOV64rm $rsp, 1, $noreg, [[DISP]] |