Hook into PassManager's analysis verification.

By overriding Pass::verifyAnalysis(), the pass contents will be verified
by the pass manager.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160994 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2012-07-30 20:57:50 +00:00
parent 32ecfb4158
commit ef6c76c984
3 changed files with 4 additions and 7 deletions

View File

@ -586,13 +586,13 @@ void EarlyIfConverter::updateLoops(ArrayRef<MachineBasicBlock*> Removed) {
/// Invalidate MachineTraceMetrics before if-conversion. /// Invalidate MachineTraceMetrics before if-conversion.
void EarlyIfConverter::invalidateTraces() { void EarlyIfConverter::invalidateTraces() {
Traces->verify(); Traces->verifyAnalysis();
Traces->invalidate(IfConv.Head); Traces->invalidate(IfConv.Head);
Traces->invalidate(IfConv.Tail); Traces->invalidate(IfConv.Tail);
Traces->invalidate(IfConv.TBB); Traces->invalidate(IfConv.TBB);
Traces->invalidate(IfConv.FBB); Traces->invalidate(IfConv.FBB);
DEBUG(if (MinInstr) MinInstr->print(dbgs())); DEBUG(if (MinInstr) MinInstr->print(dbgs()));
Traces->verify(); Traces->verifyAnalysis();
} }
/// Apply cost model and heuristics to the if-conversion in IfConv. /// Apply cost model and heuristics to the if-conversion in IfConv.

View File

@ -284,7 +284,7 @@ void MachineTraceMetrics::invalidate(const MachineBasicBlock *MBB) {
Ensembles[i]->invalidate(MBB); Ensembles[i]->invalidate(MBB);
} }
void MachineTraceMetrics::verify() const { void MachineTraceMetrics::verifyAnalysis() const {
#ifndef NDEBUG #ifndef NDEBUG
assert(BlockInfo.size() == MF->getNumBlockIDs() && "Outdated BlockInfo size"); assert(BlockInfo.size() == MF->getNumBlockIDs() && "Outdated BlockInfo size");
for (unsigned i = 0; i != TS_NumStrategies; ++i) for (unsigned i = 0; i != TS_NumStrategies; ++i)

View File

@ -75,6 +75,7 @@ public:
void getAnalysisUsage(AnalysisUsage&) const; void getAnalysisUsage(AnalysisUsage&) const;
bool runOnMachineFunction(MachineFunction&); bool runOnMachineFunction(MachineFunction&);
void releaseMemory(); void releaseMemory();
void verifyAnalysis() const;
friend class Ensemble; friend class Ensemble;
friend class Trace; friend class Trace;
@ -212,10 +213,6 @@ public:
/// is erased, or the CFG is otherwise changed. /// is erased, or the CFG is otherwise changed.
void invalidate(const MachineBasicBlock *MBB); void invalidate(const MachineBasicBlock *MBB);
/// Verify the internal consistency of cached data.
/// This does nothing in NDEBUG builds.
void verify() const;
private: private:
// One entry per basic block, indexed by block number. // One entry per basic block, indexed by block number.
SmallVector<FixedBlockInfo, 4> BlockInfo; SmallVector<FixedBlockInfo, 4> BlockInfo;