summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorSean Silva <chisophugis@gmail.com>2016-07-07 01:01:53 +0000
committerSean Silva <chisophugis@gmail.com>2016-07-07 01:01:53 +0000
commit284b0324e217e38c3992536545f3e72f425a1daa (patch)
tree77c56891f0b34663d1977fdba1ccc77b84b75717 /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parentade4eed8a72103eee21c57b5feb0fb17ec3c5f3b (diff)
downloadbcm5719-llvm-284b0324e217e38c3992536545f3e72f425a1daa.tar.gz
bcm5719-llvm-284b0324e217e38c3992536545f3e72f425a1daa.zip
[PM] Avoid getResult on a higher level in LoopAccessAnalysis
Note that require<domtree> and require<loops> aren't needed because they come in implicitly via the loop pass manager. llvm-svn: 274712
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 92d642fd11d..ead137b9435 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2027,15 +2027,23 @@ INITIALIZE_PASS_END(LoopAccessAnalysis, LAA_NAME, laa_name, false, true)
char LoopAccessInfoAnalysis::PassID;
LoopAccessInfo LoopAccessInfoAnalysis::run(Loop &L, AnalysisManager<Loop> &AM) {
- // FIXME: ugly const cast
- AnalysisManager<Function> &FAM = const_cast<FunctionAnalysisManager &>(
- AM.getResult<FunctionAnalysisManagerLoopProxy>(L).getManager());
+ const AnalysisManager<Function> &FAM =
+ AM.getResult<FunctionAnalysisManagerLoopProxy>(L).getManager();
Function &F = *L.getHeader()->getParent();
- auto *SE = &FAM.getResult<ScalarEvolutionAnalysis>(F);
+ auto *SE = FAM.getCachedResult<ScalarEvolutionAnalysis>(F);
auto *TLI = FAM.getCachedResult<TargetLibraryAnalysis>(F);
- auto *AA = &FAM.getResult<AAManager>(F);
- auto *DT = &FAM.getResult<DominatorTreeAnalysis>(F);
- auto *LI = &FAM.getResult<LoopAnalysis>(F);
+ auto *AA = FAM.getCachedResult<AAManager>(F);
+ auto *DT = FAM.getCachedResult<DominatorTreeAnalysis>(F);
+ auto *LI = FAM.getCachedResult<LoopAnalysis>(F);
+ if (!SE)
+ report_fatal_error(
+ "ScalarEvolution must have been cached at a higher level");
+ if (!AA)
+ report_fatal_error("AliasAnalysis must have been cached at a higher level");
+ if (!DT)
+ report_fatal_error("DominatorTree must have been cached at a higher level");
+ if (!LI)
+ report_fatal_error("LoopInfo must have been cached at a higher level");
const DataLayout &DL = F.getParent()->getDataLayout();
return LoopAccessInfo(&L, SE, DL, TLI, AA, DT, LI);
}
OpenPOWER on IntegriCloud