Rename getAnalysisToUpdate to getAnalysisIfAvailable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63198 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index b226d19..5093ae9 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -99,7 +99,7 @@
 }
 
 bool InternalizePass::runOnModule(Module &M) {
-  CallGraph *CG = getAnalysisToUpdate<CallGraph>();
+  CallGraph *CG = getAnalysisIfAvailable<CallGraph>();
   CallGraphNode *ExternalNode = CG ? CG->getExternalCallingNode() : 0;
 
   if (ExternalNames.empty()) {
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp
index aed84e2..65b74b4 100644
--- a/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/lib/Transforms/Scalar/LoopRotation.cpp
@@ -457,7 +457,7 @@
            "Expected only one incoming value from Original PreHeader");
   }
 
-  if (DominatorTree *DT = getAnalysisToUpdate<DominatorTree>()) {
+  if (DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>()) {
     DT->addNewBlock(NewPreHeader, OrigPreHeader);
     DT->changeImmediateDominator(L->getHeader(), NewPreHeader);
     DT->changeImmediateDominator(Exit, OrigPreHeader);
@@ -473,7 +473,7 @@
     DT->changeImmediateDominator(OrigHeader, OrigLatch);
   }
 
-  if (DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>()) {
+  if (DominanceFrontier *DF = getAnalysisIfAvailable<DominanceFrontier>()) {
     // New Preheader's dominance frontier is Exit block.
     DominanceFrontier::DomSetType NewPHSet;
     NewPHSet.insert(Exit);
@@ -509,7 +509,7 @@
     // If a loop block dominates new loop latch then its frontier is
     // new header and Exit.
     BasicBlock *NewLatch = L->getLoopLatch();
-    DominatorTree *DT = getAnalysisToUpdate<DominatorTree>();
+    DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>();
     for (Loop::block_iterator BI = L->block_begin(), BE = L->block_end();
          BI != BE; ++BI) {
       BasicBlock *B = *BI;
diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp
index 6d685d5..2025fb6 100644
--- a/lib/Transforms/Scalar/LoopUnroll.cpp
+++ b/lib/Transforms/Scalar/LoopUnroll.cpp
@@ -170,10 +170,10 @@
     return false;
 
   // FIXME: Reconstruct dom info, because it is not preserved properly.
-  DominatorTree *DT = getAnalysisToUpdate<DominatorTree>();
+  DominatorTree *DT = getAnalysisIfAvailable<DominatorTree>();
   if (DT) {
     DT->runOnFunction(*F);
-    DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>();
+    DominanceFrontier *DF = getAnalysisIfAvailable<DominanceFrontier>();
     if (DF)
       DF->runOnFunction(*F);
   }
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index 97aa475..a563c7a 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -188,8 +188,8 @@
 bool LoopUnswitch::runOnLoop(Loop *L, LPPassManager &LPM_Ref) {
   LI = &getAnalysis<LoopInfo>();
   LPM = &LPM_Ref;
-  DF = getAnalysisToUpdate<DominanceFrontier>();
-  DT = getAnalysisToUpdate<DominatorTree>();
+  DF = getAnalysisIfAvailable<DominanceFrontier>();
+  DT = getAnalysisIfAvailable<DominatorTree>();
   currentLoop = L;
   Function *F = currentLoop->getHeader()->getParent();
   bool Changed = false;
diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp
index 431424e..7b633b2 100644
--- a/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -136,7 +136,7 @@
   
   // Finally, erase the old block and update dominator info.
   if (P) {
-    if (DominatorTree* DT = P->getAnalysisToUpdate<DominatorTree>()) {
+    if (DominatorTree* DT = P->getAnalysisIfAvailable<DominatorTree>()) {
       DomTreeNode* DTN = DT->getNode(BB);
       DomTreeNode* PredDTN = DT->getNode(PredBB);
   
@@ -299,11 +299,11 @@
   BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split");
 
   // The new block lives in whichever loop the old one did.
-  if (LoopInfo* LI = P->getAnalysisToUpdate<LoopInfo>())
+  if (LoopInfo* LI = P->getAnalysisIfAvailable<LoopInfo>())
     if (Loop *L = LI->getLoopFor(Old))
       L->addBasicBlockToLoop(New, LI->getBase());
 
-  if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) 
+  if (DominatorTree *DT = P->getAnalysisIfAvailable<DominatorTree>())
     {
       // Old dominates New. New node domiantes all other nodes dominated by Old.
       DomTreeNode *OldNode = DT->getNode(Old);
@@ -319,7 +319,7 @@
         DT->changeImmediateDominator(*I, NewNode);
     }
 
-  if (DominanceFrontier *DF = P->getAnalysisToUpdate<DominanceFrontier>())
+  if (DominanceFrontier *DF = P->getAnalysisIfAvailable<DominanceFrontier>())
     DF->splitBlock(Old);
     
   return New;
@@ -350,12 +350,12 @@
     Preds[i]->getTerminator()->replaceUsesOfWith(BB, NewBB);
   
   // Update dominator tree and dominator frontier if available.
-  DominatorTree *DT = P ? P->getAnalysisToUpdate<DominatorTree>() : 0;
+  DominatorTree *DT = P ? P->getAnalysisIfAvailable<DominatorTree>() : 0;
   if (DT)
     DT->splitBlock(NewBB);
-  if (DominanceFrontier *DF = P ? P->getAnalysisToUpdate<DominanceFrontier>():0)
+  if (DominanceFrontier *DF = P ? P->getAnalysisIfAvailable<DominanceFrontier>():0)
     DF->splitBlock(NewBB);
-  AliasAnalysis *AA = P ? P->getAnalysisToUpdate<AliasAnalysis>() : 0;
+  AliasAnalysis *AA = P ? P->getAnalysisIfAvailable<AliasAnalysis>() : 0;
   
   
   // Insert a new PHI node into NewBB for every PHI node in BB and that new PHI
diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp
index a32c016..c4fd1ea 100644
--- a/lib/Transforms/Utils/BreakCriticalEdges.cpp
+++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp
@@ -187,7 +187,7 @@
   bool NewBBDominatesDestBB = true;
   
   // Should we update DominatorTree information?
-  if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) {
+  if (DominatorTree *DT = P->getAnalysisIfAvailable<DominatorTree>()) {
     DomTreeNode *TINode = DT->getNode(TIBB);
 
     // The new block is not the immediate dominator for any other nodes, but
@@ -218,7 +218,7 @@
   }
 
   // Should we update DominanceFrontier information?
-  if (DominanceFrontier *DF = P->getAnalysisToUpdate<DominanceFrontier>()) {
+  if (DominanceFrontier *DF = P->getAnalysisIfAvailable<DominanceFrontier>()) {
     // If NewBBDominatesDestBB hasn't been computed yet, do so with DF.
     if (!OtherPreds.empty()) {
       // FIXME: IMPLEMENT THIS!
@@ -252,7 +252,7 @@
   }
   
   // Update LoopInfo if it is around.
-  if (LoopInfo *LI = P->getAnalysisToUpdate<LoopInfo>()) {
+  if (LoopInfo *LI = P->getAnalysisIfAvailable<LoopInfo>()) {
     // If one or the other blocks were not in a loop, the new block is not
     // either, and thus LI doesn't need to be updated.
     if (Loop *TIL = LI->getLoopFor(TIBB))
diff --git a/lib/Transforms/Utils/CloneLoop.cpp b/lib/Transforms/Utils/CloneLoop.cpp
index d52d795..a0306ff 100644
--- a/lib/Transforms/Utils/CloneLoop.cpp
+++ b/lib/Transforms/Utils/CloneLoop.cpp
@@ -79,8 +79,8 @@
   DominatorTree *DT = NULL;
   DominanceFrontier *DF = NULL;
   if (P) {
-    DT = P->getAnalysisToUpdate<DominatorTree>();
-    DF = P->getAnalysisToUpdate<DominanceFrontier>();
+    DT = P->getAnalysisIfAvailable<DominatorTree>();
+    DF = P->getAnalysisIfAvailable<DominanceFrontier>();
   }
 
   SmallVector<BasicBlock *, 16> NewBlocks;
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp
index af41036..03d273d 100644
--- a/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/lib/Transforms/Utils/LoopSimplify.cpp
@@ -112,7 +112,7 @@
 bool LoopSimplify::runOnFunction(Function &F) {
   bool Changed = false;
   LI = &getAnalysis<LoopInfo>();
-  AA = getAnalysisToUpdate<AliasAnalysis>();
+  AA = getAnalysisIfAvailable<AliasAnalysis>();
   DT = &getAnalysis<DominatorTree>();
 
   // Check to see that no blocks (other than the header) in loops have
@@ -595,6 +595,6 @@
 
   // Update dominator information
   DT->splitBlock(BEBlock);
-  if (DominanceFrontier *DF = getAnalysisToUpdate<DominanceFrontier>())
+  if (DominanceFrontier *DF = getAnalysisIfAvailable<DominanceFrontier>())
     DF->splitBlock(BEBlock);
 }