[llvm] r261890 - Revert "Introduce DominanceFrontierAnalysis to the new PassManager to compute DominanceFrontier. NFC"
Hongbin Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 25 08:45:46 PST 2016
Author: ether
Date: Thu Feb 25 10:45:46 2016
New Revision: 261890
URL: http://llvm.org/viewvc/llvm-project?rev=261890&view=rev
Log:
Revert "Introduce DominanceFrontierAnalysis to the new PassManager to compute DominanceFrontier. NFC"
This reverts commit 109c38b2226a87b0be73fa7a0a8c1a81df20aeb2.
Removed:
llvm/trunk/test/Analysis/DominanceFrontier/new_pm_test.ll
Modified:
llvm/trunk/include/llvm/Analysis/DominanceFrontier.h
llvm/trunk/include/llvm/InitializePasses.h
llvm/trunk/lib/Analysis/Analysis.cpp
llvm/trunk/lib/Analysis/DominanceFrontier.cpp
llvm/trunk/lib/Analysis/RegionInfo.cpp
llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp
llvm/trunk/lib/CodeGen/MachineRegionInfo.cpp
llvm/trunk/lib/Passes/PassBuilder.cpp
llvm/trunk/lib/Passes/PassRegistry.def
Modified: llvm/trunk/include/llvm/Analysis/DominanceFrontier.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominanceFrontier.h?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominanceFrontier.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominanceFrontier.h Thu Feb 25 10:45:46 2016
@@ -24,11 +24,6 @@
namespace llvm {
-// FIXME: Replace this brittle forward declaration with the include of the new
-// PassManager.h when doing so doesn't break the PassManagerBuilder.
-template <typename IRUnitT> class AnalysisManager;
-class PreservedAnalyses;
-
//===----------------------------------------------------------------------===//
/// DominanceFrontierBase - Common base class for computing forward and inverse
/// dominance frontiers for a function.
@@ -138,69 +133,78 @@ public:
const DomSetType &calculate(const DomTreeT &DT, const DomTreeNodeT *Node);
};
-class DominanceFrontier : public ForwardDominanceFrontierBase<BasicBlock> {
+class DominanceFrontier : public FunctionPass {
+ ForwardDominanceFrontierBase<BasicBlock> Base;
+
public:
typedef DominatorTreeBase<BasicBlock> DomTreeT;
typedef DomTreeNodeBase<BasicBlock> DomTreeNodeT;
typedef DominanceFrontierBase<BasicBlock>::DomSetType DomSetType;
typedef DominanceFrontierBase<BasicBlock>::iterator iterator;
typedef DominanceFrontierBase<BasicBlock>::const_iterator const_iterator;
-};
-class DominanceFrontierWrapperPass : public FunctionPass {
- DominanceFrontier DF;
-public:
static char ID; // Pass ID, replacement for typeid
- DominanceFrontierWrapperPass();
+ DominanceFrontier();
- DominanceFrontier &getDominanceFrontier() { return DF; }
- const DominanceFrontier &getDominanceFrontier() const { return DF; }
+ ForwardDominanceFrontierBase<BasicBlock> &getBase() { return Base; }
- void releaseMemory() override;
+ inline const std::vector<BasicBlock *> &getRoots() const {
+ return Base.getRoots();
+ }
- bool runOnFunction(Function &) override;
+ BasicBlock *getRoot() const { return Base.getRoot(); }
- void getAnalysisUsage(AnalysisUsage &AU) const override;
+ bool isPostDominator() const { return Base.isPostDominator(); }
- void print(raw_ostream &OS, const Module * = nullptr) const override;
+ iterator begin() { return Base.begin(); }
- void dump() const;
-};
+ const_iterator begin() const { return Base.begin(); }
-extern template class DominanceFrontierBase<BasicBlock>;
-extern template class ForwardDominanceFrontierBase<BasicBlock>;
+ iterator end() { return Base.end(); }
-/// \brief Analysis pass which computes a \c DominanceFrontier.
-class DominanceFrontierAnalysis {
-public:
- /// \brief Provide the result typedef for this analysis pass.
- typedef DominanceFrontier Result;
+ const_iterator end() const { return Base.end(); }
- /// \brief Opaque, unique identifier for this analysis pass.
- static void *ID() { return (void *)&PassID; }
+ iterator find(BasicBlock *B) { return Base.find(B); }
- /// \brief Run the analysis pass over a function and produce a dominator tree.
- DominanceFrontier run(Function &F, AnalysisManager<Function> *AM);
+ const_iterator find(BasicBlock *B) const { return Base.find(B); }
- /// \brief Provide access to a name for this pass for debugging purposes.
- static StringRef name() { return "DominanceFrontierAnalysis"; }
+ iterator addBasicBlock(BasicBlock *BB, const DomSetType &frontier) {
+ return Base.addBasicBlock(BB, frontier);
+ }
-private:
- static char PassID;
-};
+ void removeBlock(BasicBlock *BB) { return Base.removeBlock(BB); }
+
+ void addToFrontier(iterator I, BasicBlock *Node) {
+ return Base.addToFrontier(I, Node);
+ }
-/// \brief Printer pass for the \c DominanceFrontier.
-class DominanceFrontierPrinterPass {
- raw_ostream &OS;
+ void removeFromFrontier(iterator I, BasicBlock *Node) {
+ return Base.removeFromFrontier(I, Node);
+ }
-public:
- explicit DominanceFrontierPrinterPass(raw_ostream &OS);
- PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
+ bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
+ return Base.compareDomSet(DS1, DS2);
+ }
+
+ bool compare(DominanceFrontierBase<BasicBlock> &Other) const {
+ return Base.compare(Other);
+ }
+
+ void releaseMemory() override;
+
+ bool runOnFunction(Function &) override;
+
+ void getAnalysisUsage(AnalysisUsage &AU) const override;
+
+ void print(raw_ostream &OS, const Module * = nullptr) const override;
- static StringRef name() { return "DominanceFrontierAnalysis"; }
+ void dump() const;
};
+extern template class DominanceFrontierBase<BasicBlock>;
+extern template class ForwardDominanceFrontierBase<BasicBlock>;
+
} // End llvm namespace
#endif
Modified: llvm/trunk/include/llvm/InitializePasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InitializePasses.h (original)
+++ llvm/trunk/include/llvm/InitializePasses.h Thu Feb 25 10:45:46 2016
@@ -111,7 +111,7 @@ void initializeDomOnlyPrinterPass(PassRe
void initializeDomOnlyViewerPass(PassRegistry&);
void initializeDomPrinterPass(PassRegistry&);
void initializeDomViewerPass(PassRegistry&);
-void initializeDominanceFrontierWrapperPassPass(PassRegistry&);
+void initializeDominanceFrontierPass(PassRegistry&);
void initializeDominatorTreeWrapperPassPass(PassRegistry&);
void initializeEarlyIfConverterPass(PassRegistry&);
void initializeEdgeBundlesPass(PassRegistry&);
Modified: llvm/trunk/lib/Analysis/Analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Analysis.cpp?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/Analysis.cpp (original)
+++ llvm/trunk/lib/Analysis/Analysis.cpp Thu Feb 25 10:45:46 2016
@@ -38,7 +38,7 @@ void llvm::initializeAnalysis(PassRegist
initializeDelinearizationPass(Registry);
initializeDemandedBitsPass(Registry);
initializeDivergenceAnalysisPass(Registry);
- initializeDominanceFrontierWrapperPassPass(Registry);
+ initializeDominanceFrontierPass(Registry);
initializeDomViewerPass(Registry);
initializeDomPrinterPass(Registry);
initializeDomOnlyViewerPass(Registry);
Modified: llvm/trunk/lib/Analysis/DominanceFrontier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DominanceFrontier.cpp?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DominanceFrontier.cpp (original)
+++ llvm/trunk/lib/Analysis/DominanceFrontier.cpp Thu Feb 25 10:45:46 2016
@@ -9,7 +9,6 @@
#include "llvm/Analysis/DominanceFrontier.h"
#include "llvm/Analysis/DominanceFrontierImpl.h"
-#include "llvm/IR/PassManager.h"
using namespace llvm;
@@ -18,60 +17,41 @@ template class DominanceFrontierBase<Bas
template class ForwardDominanceFrontierBase<BasicBlock>;
}
-char DominanceFrontierWrapperPass::ID = 0;
+char DominanceFrontier::ID = 0;
-INITIALIZE_PASS_BEGIN(DominanceFrontierWrapperPass, "domfrontier",
+INITIALIZE_PASS_BEGIN(DominanceFrontier, "domfrontier",
"Dominance Frontier Construction", true, true)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
-INITIALIZE_PASS_END(DominanceFrontierWrapperPass, "domfrontier",
+INITIALIZE_PASS_END(DominanceFrontier, "domfrontier",
"Dominance Frontier Construction", true, true)
- DominanceFrontierWrapperPass::DominanceFrontierWrapperPass()
- : FunctionPass(ID), DF() {
- initializeDominanceFrontierWrapperPassPass(*PassRegistry::getPassRegistry());
+DominanceFrontier::DominanceFrontier()
+ : FunctionPass(ID),
+ Base() {
+ initializeDominanceFrontierPass(*PassRegistry::getPassRegistry());
}
-void DominanceFrontierWrapperPass::releaseMemory() {
- DF.releaseMemory();
+void DominanceFrontier::releaseMemory() {
+ Base.releaseMemory();
}
-bool DominanceFrontierWrapperPass::runOnFunction(Function &) {
+bool DominanceFrontier::runOnFunction(Function &) {
releaseMemory();
- DF.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
+ Base.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
return false;
}
-void DominanceFrontierWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
+void DominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<DominatorTreeWrapperPass>();
}
-void DominanceFrontierWrapperPass::print(raw_ostream &OS, const Module *) const {
- DF.print(OS);
+void DominanceFrontier::print(raw_ostream &OS, const Module *) const {
+ Base.print(OS);
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void DominanceFrontierWrapperPass::dump() const {
+LLVM_DUMP_METHOD void DominanceFrontier::dump() const {
print(dbgs());
}
#endif
-
-char DominanceFrontierAnalysis::PassID;
-
-DominanceFrontier DominanceFrontierAnalysis::run(Function &F,
- FunctionAnalysisManager *AM) {
- DominanceFrontier DF;
- DF.analyze(AM->getResult<DominatorTreeAnalysis>(F));
- return DF;
-}
-
-DominanceFrontierPrinterPass::DominanceFrontierPrinterPass(raw_ostream &OS)
- : OS(OS) {}
-
-PreservedAnalyses
-DominanceFrontierPrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
- OS << "DominanceFrontier for function: " << F.getName() << "\n";
- AM->getResult<DominanceFrontierAnalysis>(F).print(OS);
-
- return PreservedAnalyses::all();
-}
Modified: llvm/trunk/lib/Analysis/RegionInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/RegionInfo.cpp?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/RegionInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/RegionInfo.cpp Thu Feb 25 10:45:46 2016
@@ -129,7 +129,7 @@ bool RegionInfoPass::runOnFunction(Funct
auto DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
auto PDT = &getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
- auto DF = &getAnalysis<DominanceFrontierWrapperPass>().getDominanceFrontier();
+ auto DF = &getAnalysis<DominanceFrontier>();
RI.recalculate(F, DT, PDT, DF);
return false;
@@ -146,8 +146,8 @@ void RegionInfoPass::verifyAnalysis() co
void RegionInfoPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequiredTransitive<DominatorTreeWrapperPass>();
+ AU.addRequired<DominanceFrontier>();
AU.addRequired<PostDominatorTreeWrapperPass>();
- AU.addRequired<DominanceFrontierWrapperPass>();
}
void RegionInfoPass::print(raw_ostream &OS, const Module *) const {
@@ -165,8 +165,8 @@ char RegionInfoPass::ID = 0;
INITIALIZE_PASS_BEGIN(RegionInfoPass, "regions",
"Detect single entry single exit regions", true, true)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(DominanceFrontier)
INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(DominanceFrontierWrapperPass)
INITIALIZE_PASS_END(RegionInfoPass, "regions",
"Detect single entry single exit regions", true, true)
Modified: llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunctionPass.cpp Thu Feb 25 10:45:46 2016
@@ -53,7 +53,7 @@ void MachineFunctionPass::getAnalysisUsa
// because CodeGen overloads that to mean preserving the MachineBasicBlock
// CFG in addition to the LLVM IR CFG.
AU.addPreserved<BasicAAWrapperPass>();
- AU.addPreserved<DominanceFrontierWrapperPass>();
+ AU.addPreserved<DominanceFrontier>();
AU.addPreserved<DominatorTreeWrapperPass>();
AU.addPreserved<AAResultsWrapperPass>();
AU.addPreserved<GlobalsAAWrapperPass>();
Modified: llvm/trunk/lib/CodeGen/MachineRegionInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegionInfo.cpp?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineRegionInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineRegionInfo.cpp Thu Feb 25 10:45:46 2016
@@ -105,7 +105,7 @@ void MachineRegionInfoPass::getAnalysisU
AU.setPreservesAll();
AU.addRequiredTransitive<DominatorTreeWrapperPass>();
AU.addRequired<PostDominatorTreeWrapperPass>();
- AU.addRequired<DominanceFrontierWrapperPass>();
+ AU.addRequired<DominanceFrontier>();
}
void MachineRegionInfoPass::print(raw_ostream &OS, const Module *) const {
Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Thu Feb 25 10:45:46 2016
@@ -22,7 +22,6 @@
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/CFLAliasAnalysis.h"
#include "llvm/Analysis/CGSCCPassManager.h"
-#include "llvm/Analysis/DominanceFrontier.h"
#include "llvm/Analysis/LazyCallGraph.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/PostDominators.h"
Modified: llvm/trunk/lib/Passes/PassRegistry.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=261890&r1=261889&r2=261890&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassRegistry.def (original)
+++ llvm/trunk/lib/Passes/PassRegistry.def Thu Feb 25 10:45:46 2016
@@ -58,7 +58,6 @@ FUNCTION_ANALYSIS("aa", AAManager())
FUNCTION_ANALYSIS("assumptions", AssumptionAnalysis())
FUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis())
FUNCTION_ANALYSIS("postdomtree", PostDominatorTreeAnalysis())
-FUNCTION_ANALYSIS("domfrontier", DominanceFrontierAnalysis())
FUNCTION_ANALYSIS("loops", LoopAnalysis())
FUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis())
FUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
@@ -92,7 +91,6 @@ FUNCTION_PASS("print", PrintFunctionPass
FUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(dbgs()))
FUNCTION_PASS("print<domtree>", DominatorTreePrinterPass(dbgs()))
FUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(dbgs()))
-FUNCTION_PASS("print<domfrontier>", DominanceFrontierPrinterPass(dbgs()))
FUNCTION_PASS("print<loops>", LoopPrinterPass(dbgs()))
FUNCTION_PASS("print<scalar-evolution>", ScalarEvolutionPrinterPass(dbgs()))
FUNCTION_PASS("simplify-cfg", SimplifyCFGPass())
Removed: llvm/trunk/test/Analysis/DominanceFrontier/new_pm_test.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/DominanceFrontier/new_pm_test.ll?rev=261889&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/DominanceFrontier/new_pm_test.ll (original)
+++ llvm/trunk/test/Analysis/DominanceFrontier/new_pm_test.ll (removed)
@@ -1,50 +0,0 @@
-; REQUIRES: asserts
-; RUN: opt < %s -passes='print<domfrontier>' 2>&1 | FileCheck %s
-
-define void @a_linear_impl_fig_1() nounwind {
-0:
- br label %"1"
-1:
- br label %"2"
-2:
- br label %"3"
-3:
- br i1 1, label %"13", label %"4"
-4:
- br i1 1, label %"5", label %"1"
-5:
- br i1 1, label %"8", label %"6"
-6:
- br i1 1, label %"7", label %"4"
-7:
- ret void
-8:
- br i1 1, label %"9", label %"1"
-9:
- br label %"10"
-10:
- br i1 1, label %"12", label %"11"
-11:
- br i1 1, label %"9", label %"8"
-13:
- br i1 1, label %"2", label %"1"
-12:
- switch i32 0, label %"1" [ i32 0, label %"9"
- i32 1, label %"8"]
-}
-
-; CHECK: DominanceFrontier for function: a_linear_impl_fig_1
-; CHECK-DAG: DomFrontier for BB %"0" is:
-; CHECK-DAG: DomFrontier for BB %"11" is: %"8" %"9"
-; CHECK-DAG: DomFrontier for BB %"1" is: %"1"
-; CHECK-DAG: DomFrontier for BB %"2" is: %"1" %"2"
-; CHECK-DAG: DomFrontier for BB %"3" is: %"1" %"2"
-; CHECK-DAG: DomFrontier for BB %"13" is: %"1" %"2"
-; CHECK-DAG: DomFrontier for BB %"4" is: %"1" %"4"
-; CHECK-DAG: DomFrontier for BB %"5" is: %"1" %"4"
-; CHECK-DAG: DomFrontier for BB %"8" is: %"1" %"8"
-; CHECK-DAG: DomFrontier for BB %"6" is: %"4"
-; CHECK-DAG: DomFrontier for BB %"7" is:
-; CHECK-DAG: DomFrontier for BB %"9" is: %"1" %"8" %"9"
-; CHECK-DAG: DomFrontier for BB %"10" is: %"1" %"8" %"9"
-; CHECK-DAG: DomFrontier for BB %"12" is: %"1" %"8" %"9"
More information about the llvm-commits
mailing list