summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineTraceMetrics.h
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-10-08 22:06:44 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-10-08 22:06:44 +0000
commit9d1173a86e6cad50e506008bc3e35b57c714612d (patch)
tree28044e2d5b378b891da468be97321acb0045b34a /llvm/lib/CodeGen/MachineTraceMetrics.h
parent73ea2defb22c0cd4da7fab6c387e827291e79734 (diff)
downloadbcm5719-llvm-9d1173a86e6cad50e506008bc3e35b57c714612d.tar.gz
bcm5719-llvm-9d1173a86e6cad50e506008bc3e35b57c714612d.zip
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. llvm-svn: 165434
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.h')
-rw-r--r--llvm/lib/CodeGen/MachineTraceMetrics.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineTraceMetrics.h b/llvm/lib/CodeGen/MachineTraceMetrics.h
index d329c51634a..5f3b1d23e41 100644
--- a/llvm/lib/CodeGen/MachineTraceMetrics.h
+++ b/llvm/lib/CodeGen/MachineTraceMetrics.h
@@ -165,6 +165,14 @@ public:
/// Invalidate height resources when a block below this one has changed.
void invalidateHeight() { InstrHeight = ~0u; HasValidInstrHeights = false; }
+ /// Determine if this block belongs to the same trace as TBI and comes
+ /// before it in the trace.
+ /// Also returns true when TBI == this.
+ bool isEarlierInSameTrace(const TraceBlockInfo &TBI) const {
+ return hasValidDepth() && TBI.hasValidDepth() &&
+ Head == TBI.Head && InstrDepth <= TBI.InstrDepth;
+ }
+
// Data-dependency-related information. Per-instruction depth and height
// are computed from data dependencies in the current trace, using
// itinerary data.
OpenPOWER on IntegriCloud