diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2016-03-11 13:53:18 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2016-03-11 13:53:18 +0000 |
commit | 5bfbc3f94122e26f5fe07e905ec31d391f2cecae (patch) | |
tree | 26e55a32fda505b481592a2a23f3dbaad8c15881 | |
parent | 7a4eed280a6d0b11895662d3509aff08009492c3 (diff) | |
download | bcm5719-llvm-5bfbc3f94122e26f5fe07e905ec31d391f2cecae.tar.gz bcm5719-llvm-5bfbc3f94122e26f5fe07e905ec31d391f2cecae.zip |
[AA] Make BasicAA just require domtree.
This doesn't change how many times we construct domtrees in the normal
pipeline, and it removes fragility and instability where basic-aa may
not be run in time to see domtrees because they happen to be constructed
afterward.
This isn't quite as clean as the change to memdep because there is
a mode where basic-aa specifically runs without domtrees -- in the
hacking version used by function-attrs with the legacy pass manager.
llvm-svn: 263234
-rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 18972105b88..d8f6f109815 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -1612,7 +1612,7 @@ BasicAAResult BasicAA::run(Function &F, AnalysisManager<Function> &AM) { return BasicAAResult(F.getParent()->getDataLayout(), AM.getResult<TargetLibraryAnalysis>(F), AM.getResult<AssumptionAnalysis>(F), - AM.getCachedResult<DominatorTreeAnalysis>(F), + &AM.getResult<DominatorTreeAnalysis>(F), AM.getCachedResult<LoopAnalysis>(F)); } @@ -1626,6 +1626,7 @@ void BasicAAWrapperPass::anchor() {} INITIALIZE_PASS_BEGIN(BasicAAWrapperPass, "basicaa", "Basic Alias Analysis (stateless AA impl)", true, true) INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) +INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) INITIALIZE_PASS_END(BasicAAWrapperPass, "basicaa", "Basic Alias Analysis (stateless AA impl)", true, true) @@ -1637,12 +1638,11 @@ FunctionPass *llvm::createBasicAAWrapperPass() { bool BasicAAWrapperPass::runOnFunction(Function &F) { auto &ACT = getAnalysis<AssumptionCacheTracker>(); auto &TLIWP = getAnalysis<TargetLibraryInfoWrapperPass>(); - auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>(); + auto &DTWP = getAnalysis<DominatorTreeWrapperPass>(); auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>(); Result.reset(new BasicAAResult(F.getParent()->getDataLayout(), TLIWP.getTLI(), - ACT.getAssumptionCache(F), - DTWP ? &DTWP->getDomTree() : nullptr, + ACT.getAssumptionCache(F), &DTWP.getDomTree(), LIWP ? &LIWP->getLoopInfo() : nullptr)); return false; @@ -1651,6 +1651,7 @@ bool BasicAAWrapperPass::runOnFunction(Function &F) { void BasicAAWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired<AssumptionCacheTracker>(); + AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<TargetLibraryInfoWrapperPass>(); } |