Don't crash on extra evil irreducible control flow.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 8 Oct 2012 22:06:44 +0000 (22:06 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 8 Oct 2012 22:06:44 +0000 (22:06 +0000)
commit6be75ae196e0138048f685d4df7128d24245be5e
treee83ffed484c84711fe9a76908f8969ec8e5e8470
parent8e635dbc78996bc18cf13b4806706cf3529ea646
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
lib/CodeGen/MachineTraceMetrics.cpp
lib/CodeGen/MachineTraceMetrics.h
test/CodeGen/X86/early-ifcvt.ll