[PATCH] D78166: [InlineSpiller] add assert about spills post terminators
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 16:52:38 PDT 2020
nickdesaulniers created this revision.
nickdesaulniers added reviewers: void, efriedma, arsenm.
Herald added subscribers: llvm-commits, hiraditya, wdng, qcolombet.
Herald added a project: LLVM.
nickdesaulniers added a comment.
I'm not particularly attached to this patch; just posting it for now. None of the current test cases in tree violate it, only the test case from https://reviews.llvm.org/D77849 does.
This invariant is being violated in the test case
https://reviews.llvm.org/D77849, related to the use of the relatively
new ability for callbr to have return values, and MachineBasicBlocks
with INLINEASM_BR terminators to emit live out register defs.
As noted in the comment, this triggers invariant violations in
MachineVerifier via `llc -verify-machineinstrs` or
`llc -verify-regalloc`, since only MachineInstrs that are terminators
are allowed to follow the first terminator.
https://reviews.llvm.org/D75098 may rework this very assertion if we're
spilling via a (proposed) TCOPY MachineInstr.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78166
Files:
llvm/lib/CodeGen/InlineSpiller.cpp
Index: llvm/lib/CodeGen/InlineSpiller.cpp
===================================================================
--- llvm/lib/CodeGen/InlineSpiller.cpp
+++ llvm/lib/CodeGen/InlineSpiller.cpp
@@ -945,6 +945,10 @@
/// insertSpill - Insert a spill of NewVReg after MI.
void InlineSpiller::insertSpill(unsigned NewVReg, bool isKill,
MachineBasicBlock::iterator MI) {
+ // Spill are not terminators, so inserting spills after terminators will
+ // violate invariants in MachineVerifier. This is commonly observed with
+ // -verify-machineinstrs or even -verify-regalloc.
+ assert(!MI->isTerminator() && "Inserting a spill after a terminator");
MachineBasicBlock &MBB = *MI->getParent();
MachineInstrSpan MIS(MI, &MBB);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78166.257553.patch
Type: text/x-patch
Size: 759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200414/162b841a/attachment.bin>
More information about the llvm-commits
mailing list