Give ScalarEvolution access to the DominatorTree. It'll need this
authorDan Gohman <gohman@apple.com>
Tue, 19 Jan 2010 22:21:27 +0000 (22:21 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 19 Jan 2010 22:21:27 +0000 (22:21 +0000)
to make more intellegent AddRec folding decisions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93930 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp

index 6f57c741fe585614a6f556ef3d33a75f20e9f789..9072a8f0502c6acaf869b149e934188969a6516b 100644 (file)
@@ -181,6 +181,10 @@ namespace llvm {
     ///
     TargetData *TD;
 
+    /// DT - The dominator tree.
+    ///
+    DominatorTree *DT;
+
     /// CouldNotCompute - This SCEV is used to represent unknown trip
     /// counts and things.
     SCEVCouldNotCompute CouldNotCompute;
index 4d85ce43d20126b9c02f0a7506a4856ef25b5c0c..a06321cecfd7d727582ebc02ed7c6a345422031e 100644 (file)
@@ -5167,6 +5167,7 @@ ScalarEvolution::ScalarEvolution()
 bool ScalarEvolution::runOnFunction(Function &F) {
   this->F = &F;
   LI = &getAnalysis<LoopInfo>();
+  DT = &getAnalysis<DominatorTree>();
   TD = getAnalysisIfAvailable<TargetData>();
   return false;
 }
@@ -5183,6 +5184,7 @@ void ScalarEvolution::releaseMemory() {
 void ScalarEvolution::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();
   AU.addRequiredTransitive<LoopInfo>();
+  AU.addRequiredTransitive<DominatorTree>();
 }
 
 bool ScalarEvolution::hasLoopInvariantBackedgeTakenCount(const Loop *L) {