diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-01-13 13:07:17 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-01-13 13:07:17 +0000 |
commit | 73523021d0a97c150a76a5cf4a91e99cd03b9efb (patch) | |
tree | d2719d151f36e8afd70aee405bd992cd52a2022c /llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp | |
parent | ca9af6cad9e8c57c6e04ecffb19bb56493ab7608 (diff) | |
download | bcm5719-llvm-73523021d0a97c150a76a5cf4a91e99cd03b9efb.tar.gz bcm5719-llvm-73523021d0a97c150a76a5cf4a91e99cd03b9efb.zip |
[PM] Split DominatorTree into a concrete analysis result object which
can be used by both the new pass manager and the old.
This removes it from any of the virtual mess of the pass interfaces and
lets it derive cleanly from the DominatorTreeBase<> template. In turn,
tons of boilerplate interface can be nuked and it turns into a very
straightforward extension of the base DominatorTree interface.
The old analysis pass is now a simple wrapper. The names and style of
this split should match the split between CallGraph and
CallGraphWrapperPass. All of the users of DominatorTree have been
updated to match using many of the same tricks as with CallGraph. The
goal is that the common type remains the resulting DominatorTree rather
than the pass. This will make subsequent work toward the new pass
manager significantly easier.
Also in numerous places things became cleaner because I switched from
re-running the pass (!!! mid way through some other passes run!!!) to
directly recomputing the domtree.
llvm-svn: 199104
Diffstat (limited to 'llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp index dcb5dae69e6..c5fbc340b12 100644 --- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -106,7 +106,7 @@ namespace { const char *getPassName() const { return "CodeGen Prepare"; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addPreserved<DominatorTree>(); + AU.addPreserved<DominatorTreeWrapperPass>(); AU.addRequired<TargetLibraryInfo>(); } @@ -145,7 +145,9 @@ bool CodeGenPrepare::runOnFunction(Function &F) { ModifiedDT = false; if (TM) TLI = TM->getTargetLowering(); TLInfo = &getAnalysis<TargetLibraryInfo>(); - DT = getAnalysisIfAvailable<DominatorTree>(); + DominatorTreeWrapperPass *DTWP = + getAnalysisIfAvailable<DominatorTreeWrapperPass>(); + DT = DTWP ? &DTWP->getDomTree() : 0; OptSize = F.getAttributes().hasAttribute(AttributeSet::FunctionIndex, Attribute::OptimizeForSize); @@ -219,7 +221,7 @@ bool CodeGenPrepare::runOnFunction(Function &F) { } if (ModifiedDT && DT) - DT->DT->recalculate(F); + DT->recalculate(F); return EverMadeChange; } |