diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-07-30 21:10:27 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-07-30 21:10:27 +0000 |
commit | f308c128ea84d5b3c85a5840ba28b1c93a2e77fe (patch) | |
tree | cfa06d19012caa4fdd7da2b49b3133e1ca2b48bb /llvm/lib/CodeGen/MachineTraceMetrics.cpp | |
parent | a12a7d5f749fc1ac977c174f7cf8750ffe870778 (diff) | |
download | bcm5719-llvm-f308c128ea84d5b3c85a5840ba28b1c93a2e77fe.tar.gz bcm5719-llvm-f308c128ea84d5b3c85a5840ba28b1c93a2e77fe.zip |
Assert that all trace candidate blocks have been visited by the PO.
When computing a trace, all the candidates for pred/succ must have been
visited. Filter out back-edges first, though. The PO traversal ignores
them.
Thanks to Andy for spotting this in review.
llvm-svn: 160995
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineTraceMetrics.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/MachineTraceMetrics.cpp b/llvm/lib/CodeGen/MachineTraceMetrics.cpp index c31e6bd92a9..64f4a9561f0 100644 --- a/llvm/lib/CodeGen/MachineTraceMetrics.cpp +++ b/llvm/lib/CodeGen/MachineTraceMetrics.cpp @@ -214,15 +214,12 @@ MinInstrCountEnsemble::pickTracePred(const MachineBasicBlock *MBB) { for (MachineBasicBlock::const_pred_iterator I = MBB->pred_begin(), E = MBB->pred_end(); I != E; ++I) { const MachineBasicBlock *Pred = *I; - const MachineTraceMetrics::TraceBlockInfo *PredTBI = - getDepthResources(Pred); - // Ignore invalidated predecessors. This never happens on the first scan, - // but if we rejected this predecessor earlier, it won't be revalidated. - if (!PredTBI) - continue; // Don't consider predecessors in other loops. if (getLoopFor(Pred) != CurLoop) continue; + const MachineTraceMetrics::TraceBlockInfo *PredTBI = + getDepthResources(Pred); + assert(PredTBI && "Predecessor must be visited first"); // Pick the predecessor that would give this block the smallest InstrDepth. unsigned Depth = PredTBI->InstrDepth + CurCount; if (!Best || Depth < BestDepth) @@ -242,17 +239,15 @@ MinInstrCountEnsemble::pickTraceSucc(const MachineBasicBlock *MBB) { for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(), E = MBB->succ_end(); I != E; ++I) { const MachineBasicBlock *Succ = *I; - const MachineTraceMetrics::TraceBlockInfo *SuccTBI = - getHeightResources(Succ); - // Ignore invalidated successors. - if (!SuccTBI) - continue; // Don't consider back-edges. if (CurLoop && Succ == CurLoop->getHeader()) continue; // Don't consider successors in other loops. if (getLoopFor(Succ) != CurLoop) continue; + const MachineTraceMetrics::TraceBlockInfo *SuccTBI = + getHeightResources(Succ); + assert(SuccTBI && "Successor must be visited first"); // Pick the successor that would give this block the smallest InstrHeight. unsigned Height = SuccTBI->InstrHeight; if (!Best || Height < BestHeight) |