diff options
Diffstat (limited to 'lib/Transforms/Scalar/ADCE.cpp')
-rw-r--r-- | lib/Transforms/Scalar/ADCE.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 91bed41f6c..14c68f410e 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -288,21 +288,24 @@ BasicBlock *ADCE::fixupCFG(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks, } } - - -// doADCE - Execute the Agressive Dead Code Elimination Algorithm -// -bool AgressiveDCE::runOnMethod(Method *M) { - return ADCE(M).doADCE( - getAnalysis<cfg::DominanceFrontier>(cfg::DominanceFrontier::PostDomID)); +namespace { + struct AgressiveDCE : public MethodPass { + // doADCE - Execute the Agressive Dead Code Elimination Algorithm + // + virtual bool runOnMethod(Method *M) { + return ADCE(M).doADCE( + getAnalysis<cfg::DominanceFrontier>(cfg::DominanceFrontier::PostDomID)); + } + // getAnalysisUsageInfo - We require post dominance frontiers (aka Control + // Dependence Graph) + virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, + Pass::AnalysisSet &Destroyed, + Pass::AnalysisSet &Provided) { + Requires.push_back(cfg::DominanceFrontier::PostDomID); + } + }; } - -// getAnalysisUsageInfo - We require post dominance frontiers (aka Control -// Dependence Graph) -// -void AgressiveDCE::getAnalysisUsageInfo(Pass::AnalysisSet &Requires, - Pass::AnalysisSet &Destroyed, - Pass::AnalysisSet &Provided) { - Requires.push_back(cfg::DominanceFrontier::PostDomID); +Pass *createAgressiveDCEPass() { + return new AgressiveDCE(); } |