diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-07-30 17:36:49 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-07-30 17:36:49 +0000 |
commit | eb488fe16532518160ef55bbbfcdc0d1f14ea64c (patch) | |
tree | 93492e78d1d8666e0a7ebc8066471a7d8906e0a2 /llvm/lib/CodeGen/MachineTraceMetrics.cpp | |
parent | fee94ca15bc257e7dcaa5fc137a484bead1e866b (diff) | |
download | bcm5719-llvm-eb488fe16532518160ef55bbbfcdc0d1f14ea64c.tar.gz bcm5719-llvm-eb488fe16532518160ef55bbbfcdc0d1f14ea64c.zip |
Verify that the CFG hasn't changed during invalidate().
The MachineTraceMetrics analysis must be invalidated before modifying
the CFG. This will catch some of the violations of that rule.
llvm-svn: 160969
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineTraceMetrics.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineTraceMetrics.cpp b/llvm/lib/CodeGen/MachineTraceMetrics.cpp index 54c886bdda2..d5ff128bf26 100644 --- a/llvm/lib/CodeGen/MachineTraceMetrics.cpp +++ b/llvm/lib/CodeGen/MachineTraceMetrics.cpp @@ -420,10 +420,15 @@ MachineTraceMetrics::Ensemble::invalidate(const MachineBasicBlock *BadMBB) { for (MachineBasicBlock::const_pred_iterator I = MBB->pred_begin(), E = MBB->pred_end(); I != E; ++I) { TraceBlockInfo &TBI = BlockInfo[(*I)->getNumber()]; - if (TBI.hasValidHeight() && TBI.Succ == MBB) { + if (!TBI.hasValidHeight()) + continue; + if (TBI.Succ == MBB) { TBI.invalidateHeight(); WorkList.push_back(*I); + continue; } + // Verify that TBI.Succ is actually a *I successor. + assert((!TBI.Succ || (*I)->isSuccessor(TBI.Succ)) && "CFG changed"); } } while (!WorkList.empty()); } @@ -441,10 +446,15 @@ MachineTraceMetrics::Ensemble::invalidate(const MachineBasicBlock *BadMBB) { for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(), E = MBB->succ_end(); I != E; ++I) { TraceBlockInfo &TBI = BlockInfo[(*I)->getNumber()]; - if (TBI.hasValidDepth() && TBI.Pred == MBB) { + if (!TBI.hasValidDepth()) + continue; + if (TBI.Pred == MBB) { TBI.invalidateDepth(); WorkList.push_back(*I); + continue; } + // Verify that TBI.Pred is actually a *I predecessor. + assert((!TBI.Pred || (*I)->isPredecessor(TBI.Pred)) && "CFG changed"); } } while (!WorkList.empty()); } |