Revert "Introduce analysis pass to compute PostDominators in the new pass manager. NFC"
This reverts commit a3e5cc6a51ab5ad88d1760c63284294a4e34c018.
llvm-svn: 261891
diff --git a/llvm/lib/Analysis/Analysis.cpp b/llvm/lib/Analysis/Analysis.cpp
index 9c53ded..8117419 100644
--- a/llvm/lib/Analysis/Analysis.cpp
+++ b/llvm/lib/Analysis/Analysis.cpp
@@ -60,7 +60,7 @@
initializeMemoryDependenceAnalysisPass(Registry);
initializeModuleDebugInfoPrinterPass(Registry);
initializeObjCARCAAWrapperPassPass(Registry);
- initializePostDominatorTreeWrapperPassPass(Registry);
+ initializePostDominatorTreePass(Registry);
initializeRegionInfoPassPass(Registry);
initializeRegionViewerPass(Registry);
initializeRegionPrinterPass(Registry);
diff --git a/llvm/lib/Analysis/DivergenceAnalysis.cpp b/llvm/lib/Analysis/DivergenceAnalysis.cpp
index 0e1cfcf..343fe61 100644
--- a/llvm/lib/Analysis/DivergenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DivergenceAnalysis.cpp
@@ -258,7 +258,7 @@
INITIALIZE_PASS_BEGIN(DivergenceAnalysis, "divergence", "Divergence Analysis",
false, true)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
INITIALIZE_PASS_END(DivergenceAnalysis, "divergence", "Divergence Analysis",
false, true)
@@ -268,7 +268,7 @@
void DivergenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DominatorTreeWrapperPass>();
- AU.addRequired<PostDominatorTreeWrapperPass>();
+ AU.addRequired<PostDominatorTree>();
AU.setPreservesAll();
}
@@ -284,10 +284,9 @@
return false;
DivergentValues.clear();
- auto &PDT = getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
DivergencePropagator DP(F, TTI,
getAnalysis<DominatorTreeWrapperPass>().getDomTree(),
- PDT, DivergentValues);
+ getAnalysis<PostDominatorTree>(), DivergentValues);
DP.populateWithSourcesOfDivergence();
DP.propagate();
return false;
diff --git a/llvm/lib/Analysis/DomPrinter.cpp b/llvm/lib/Analysis/DomPrinter.cpp
index 7acfb41..0c880df 100644
--- a/llvm/lib/Analysis/DomPrinter.cpp
+++ b/llvm/lib/Analysis/DomPrinter.cpp
@@ -111,36 +111,20 @@
}
};
-struct PostDominatorTreeWrapperPassAnalysisGraphTraits {
- static PostDominatorTree *getGraph(PostDominatorTreeWrapperPass *PDTWP) {
- return &PDTWP->getPostDomTree();
- }
-};
-
-struct PostDomViewer : public DOTGraphTraitsViewer<
- PostDominatorTreeWrapperPass, false,
- PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits> {
+struct PostDomViewer
+ : public DOTGraphTraitsViewer<PostDominatorTree, false> {
static char ID;
PostDomViewer() :
- DOTGraphTraitsViewer<PostDominatorTreeWrapperPass, false,
- PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits>(
- "postdom", ID){
+ DOTGraphTraitsViewer<PostDominatorTree, false>("postdom", ID){
initializePostDomViewerPass(*PassRegistry::getPassRegistry());
}
};
-struct PostDomOnlyViewer : public DOTGraphTraitsViewer<
- PostDominatorTreeWrapperPass, true,
- PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits> {
+struct PostDomOnlyViewer
+ : public DOTGraphTraitsViewer<PostDominatorTree, true> {
static char ID;
PostDomOnlyViewer() :
- DOTGraphTraitsViewer<PostDominatorTreeWrapperPass, true,
- PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits>(
- "postdomonly", ID){
+ DOTGraphTraitsViewer<PostDominatorTree, true>("postdomonly", ID){
initializePostDomOnlyViewerPass(*PassRegistry::getPassRegistry());
}
};
@@ -191,31 +175,19 @@
};
struct PostDomPrinter
- : public DOTGraphTraitsPrinter<
- PostDominatorTreeWrapperPass, false,
- PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits> {
+ : public DOTGraphTraitsPrinter<PostDominatorTree, false> {
static char ID;
PostDomPrinter() :
- DOTGraphTraitsPrinter<PostDominatorTreeWrapperPass, false,
- PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits>(
- "postdom", ID) {
+ DOTGraphTraitsPrinter<PostDominatorTree, false>("postdom", ID) {
initializePostDomPrinterPass(*PassRegistry::getPassRegistry());
}
};
struct PostDomOnlyPrinter
- : public DOTGraphTraitsPrinter<
- PostDominatorTreeWrapperPass, true,
- PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits> {
+ : public DOTGraphTraitsPrinter<PostDominatorTree, true> {
static char ID;
PostDomOnlyPrinter() :
- DOTGraphTraitsPrinter<PostDominatorTreeWrapperPass, true,
- PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits>(
- "postdomonly", ID) {
+ DOTGraphTraitsPrinter<PostDominatorTree, true>("postdomonly", ID) {
initializePostDomOnlyPrinterPass(*PassRegistry::getPassRegistry());
}
};
diff --git a/llvm/lib/Analysis/PostDominators.cpp b/llvm/lib/Analysis/PostDominators.cpp
index b515108..6d92909 100644
--- a/llvm/lib/Analysis/PostDominators.cpp
+++ b/llvm/lib/Analysis/PostDominators.cpp
@@ -16,7 +16,6 @@
#include "llvm/ADT/SetOperations.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Instructions.h"
-#include "llvm/IR/PassManager.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/GenericDomTreeConstruction.h"
using namespace llvm;
@@ -27,38 +26,25 @@
// PostDominatorTree Implementation
//===----------------------------------------------------------------------===//
-char PostDominatorTreeWrapperPass::ID = 0;
-INITIALIZE_PASS(PostDominatorTreeWrapperPass, "postdomtree",
+char PostDominatorTree::ID = 0;
+INITIALIZE_PASS(PostDominatorTree, "postdomtree",
"Post-Dominator Tree Construction", true, true)
-bool PostDominatorTreeWrapperPass::runOnFunction(Function &F) {
- DT.recalculate(F);
+bool PostDominatorTree::runOnFunction(Function &F) {
+ DT->recalculate(F);
return false;
}
-void PostDominatorTreeWrapperPass::print(raw_ostream &OS, const Module *) const {
- DT.print(OS);
+PostDominatorTree::~PostDominatorTree() {
+ delete DT;
}
+void PostDominatorTree::print(raw_ostream &OS, const Module *) const {
+ DT->print(OS);
+}
+
+
FunctionPass* llvm::createPostDomTree() {
- return new PostDominatorTreeWrapperPass();
+ return new PostDominatorTree();
}
-char PostDominatorTreeAnalysis::PassID;
-
-PostDominatorTree PostDominatorTreeAnalysis::run(Function &F) {
- PostDominatorTree PDT;
- PDT.recalculate(F);
- return PDT;
-}
-
-PostDominatorTreePrinterPass::PostDominatorTreePrinterPass(raw_ostream &OS)
- : OS(OS) {}
-
-PreservedAnalyses
-PostDominatorTreePrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
- OS << "PostDominatorTree for function: " << F.getName() << "\n";
- AM->getResult<PostDominatorTreeAnalysis>(F).print(OS);
-
- return PreservedAnalyses::all();
-}
diff --git a/llvm/lib/Analysis/RegionInfo.cpp b/llvm/lib/Analysis/RegionInfo.cpp
index dac0cdd..b6277bb 100644
--- a/llvm/lib/Analysis/RegionInfo.cpp
+++ b/llvm/lib/Analysis/RegionInfo.cpp
@@ -128,7 +128,7 @@
releaseMemory();
auto DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
- auto PDT = &getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
+ auto PDT = &getAnalysis<PostDominatorTree>();
auto DF = &getAnalysis<DominanceFrontier>();
RI.recalculate(F, DT, PDT, DF);
@@ -146,8 +146,8 @@
void RegionInfoPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequiredTransitive<DominatorTreeWrapperPass>();
+ AU.addRequired<PostDominatorTree>();
AU.addRequired<DominanceFrontier>();
- AU.addRequired<PostDominatorTreeWrapperPass>();
}
void RegionInfoPass::print(raw_ostream &OS, const Module *) const {
@@ -165,8 +165,8 @@
INITIALIZE_PASS_BEGIN(RegionInfoPass, "regions",
"Detect single entry single exit regions", true, true)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(PostDominatorTree)
INITIALIZE_PASS_DEPENDENCY(DominanceFrontier)
-INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass)
INITIALIZE_PASS_END(RegionInfoPass, "regions",
"Detect single entry single exit regions", true, true)