mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Verify that terminators follow non-terminators.
This exposes a -segmented-stacks bug. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140429 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bde81d5be9
commit
5adc07ebe8
@ -72,6 +72,8 @@ namespace {
|
||||
typedef DenseSet<unsigned> RegSet;
|
||||
typedef DenseMap<unsigned, const MachineInstr*> RegMap;
|
||||
|
||||
const MachineInstr *FirstTerminator;
|
||||
|
||||
BitVector regsReserved;
|
||||
RegSet regsLive;
|
||||
RegVector regsDefined, regsDead, regsKilled;
|
||||
@ -389,6 +391,8 @@ static bool matchPair(MachineBasicBlock::const_succ_iterator i,
|
||||
|
||||
void
|
||||
MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
|
||||
FirstTerminator = 0;
|
||||
|
||||
// Count the number of landing pad successors.
|
||||
SmallPtrSet<MachineBasicBlock*, 4> LandingPadSuccs;
|
||||
for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
|
||||
@ -570,6 +574,15 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure non-terminators don't follow terminators.
|
||||
if (MCID.isTerminator()) {
|
||||
if (!FirstTerminator)
|
||||
FirstTerminator = MI;
|
||||
} else if (FirstTerminator) {
|
||||
report("Non-terminator instruction after the first terminator", MI);
|
||||
*OS << "First terminator was:\t" << *FirstTerminator;
|
||||
}
|
||||
|
||||
StringRef ErrorInfo;
|
||||
if (!TII->verifyInstruction(MI, ErrorInfo))
|
||||
report(ErrorInfo.data(), MI);
|
||||
|
@ -1,5 +1,8 @@
|
||||
; RUN: llc < %s -mtriple=i686-linux -segmented-stacks | FileCheck %s -check-prefix=X32
|
||||
; RUN: llc < %s -mtriple=x86_64-linux -segmented-stacks | FileCheck %s -check-prefix=X64
|
||||
;
|
||||
; X86FrameLowering::adjustForSegmentedStacks is inserting code after a RET.
|
||||
; XFAIL: *
|
||||
|
||||
; Just to prevent the alloca from being optimized away
|
||||
declare void @dummy_use(i32*, i32)
|
||||
|
Loading…
x
Reference in New Issue
Block a user