mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Don't crash on extra evil irreducible control flow.
When the CFG contains a loop with multiple entry blocks, the traces computed by MachineTraceMetrics don't always have the same nice properties. Loop back-edges are normally excluded from traces, but MachineLoopInfo doesn't recognize loops with multiple entry blocks, so those back-edges may be included. Avoid asserting when that happens by adding an isEarlierInSameTrace() function that accurately determines if a dominating block is part of the same trace AND is above the currrent block in the trace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165434 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -677,7 +677,7 @@ computeCrossBlockCriticalPath(const TraceBlockInfo &TBI) {
|
||||
const MachineInstr *DefMI = MTM.MRI->getVRegDef(LIR.Reg);
|
||||
// Ignore dependencies outside the current trace.
|
||||
const TraceBlockInfo &DefTBI = BlockInfo[DefMI->getParent()->getNumber()];
|
||||
if (!DefTBI.hasValidDepth() || DefTBI.Head != TBI.Head)
|
||||
if (!DefTBI.isEarlierInSameTrace(TBI))
|
||||
continue;
|
||||
unsigned Len = LIR.Height + Cycles[DefMI].Depth;
|
||||
MaxLen = std::max(MaxLen, Len);
|
||||
@ -740,7 +740,7 @@ computeInstrDepths(const MachineBasicBlock *MBB) {
|
||||
const TraceBlockInfo&DepTBI =
|
||||
BlockInfo[Dep.DefMI->getParent()->getNumber()];
|
||||
// Ignore dependencies from outside the current trace.
|
||||
if (!DepTBI.hasValidDepth() || DepTBI.Head != TBI.Head)
|
||||
if (!DepTBI.isEarlierInSameTrace(TBI))
|
||||
continue;
|
||||
assert(DepTBI.HasValidInstrDepths && "Inconsistent dependency");
|
||||
unsigned DepCycle = Cycles.lookup(Dep.DefMI).Depth;
|
||||
|
Reference in New Issue
Block a user