mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-13 23:26:25 +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:
@@ -72,6 +72,8 @@ namespace {
|
|||||||
typedef DenseSet<unsigned> RegSet;
|
typedef DenseSet<unsigned> RegSet;
|
||||||
typedef DenseMap<unsigned, const MachineInstr*> RegMap;
|
typedef DenseMap<unsigned, const MachineInstr*> RegMap;
|
||||||
|
|
||||||
|
const MachineInstr *FirstTerminator;
|
||||||
|
|
||||||
BitVector regsReserved;
|
BitVector regsReserved;
|
||||||
RegSet regsLive;
|
RegSet regsLive;
|
||||||
RegVector regsDefined, regsDead, regsKilled;
|
RegVector regsDefined, regsDead, regsKilled;
|
||||||
@@ -389,6 +391,8 @@ static bool matchPair(MachineBasicBlock::const_succ_iterator i,
|
|||||||
|
|
||||||
void
|
void
|
||||||
MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
|
MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
|
||||||
|
FirstTerminator = 0;
|
||||||
|
|
||||||
// Count the number of landing pad successors.
|
// Count the number of landing pad successors.
|
||||||
SmallPtrSet<MachineBasicBlock*, 4> LandingPadSuccs;
|
SmallPtrSet<MachineBasicBlock*, 4> LandingPadSuccs;
|
||||||
for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
|
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;
|
StringRef ErrorInfo;
|
||||||
if (!TII->verifyInstruction(MI, ErrorInfo))
|
if (!TII->verifyInstruction(MI, ErrorInfo))
|
||||||
report(ErrorInfo.data(), MI);
|
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=i686-linux -segmented-stacks | FileCheck %s -check-prefix=X32
|
||||||
; RUN: llc < %s -mtriple=x86_64-linux -segmented-stacks | FileCheck %s -check-prefix=X64
|
; 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
|
; Just to prevent the alloca from being optimized away
|
||||||
declare void @dummy_use(i32*, i32)
|
declare void @dummy_use(i32*, i32)
|
||||||
|
Reference in New Issue
Block a user