>From b174e2c38636732f7062b90d7f11c1bf5bb42b2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?=
 <rafael.espindola@gmail.com>
Date: Mon, 20 Feb 2012 23:12:52 -0500
Subject: [PATCH 1/3] Rename dominates to dominatesUse.

---
 include/llvm/Analysis/Dominators.h           |    6 +++---
 lib/Analysis/InstructionSimplify.cpp         |    2 +-
 lib/Analysis/MemoryDependenceAnalysis.cpp    |    4 ++--
 lib/Analysis/ScalarEvolutionExpander.cpp     |    8 ++++----
 lib/Transforms/Scalar/GVN.cpp                |    2 +-
 lib/Transforms/Scalar/IndVarSimplify.cpp     |    2 +-
 lib/Transforms/Scalar/LoopStrengthReduce.cpp |    4 ++--
 lib/Transforms/Scalar/MemCpyOptimizer.cpp    |    2 +-
 lib/Transforms/Scalar/ObjCARC.cpp            |    2 +-
 lib/VMCore/Dominators.cpp                    |    5 +++--
 lib/VMCore/Verifier.cpp                      |    2 +-
 11 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index b539a78..6a06b1b 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -749,14 +749,14 @@ public:
     return DT->dominates(A, B);
   }
 
-  // dominates - Return true if A dominates B. This performs the
+  // dominatesUse - Return true if A dominates a use in B. This performs the
   // special checks necessary if A and B are in the same basic block.
-  bool dominates(const Instruction *A, const Instruction *B) const;
+  bool dominatesUse(const Instruction *A, const Instruction *B) const;
 
   /// properlyDominates - Use this instead of dominates() to determine whether a
   /// user of A can be hoisted above B.
   bool properlyDominates(const Instruction *A, const Instruction *B) const {
-    return A != B && dominates(A, B);
+    return A != B && dominatesUse(A, B);
   }
 
   bool properlyDominates(const DomTreeNode *A, const DomTreeNode *B) const {
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp
index 9b0ce11..4f10d4f 100644
--- a/lib/Analysis/InstructionSimplify.cpp
+++ b/lib/Analysis/InstructionSimplify.cpp
@@ -92,7 +92,7 @@ static bool ValueDominatesPHI(Value *V, PHINode *P, const DominatorTree *DT) {
 
   // If we have a DominatorTree then do a precise test.
   if (DT)
-    return DT->dominates(I, P);
+    return DT->dominatesUse(I, P);
 
   // Otherwise, if the instruction is in the entry block, and is not an invoke,
   // then it obviously dominates all phi nodes.
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index cfaf2da..02b43b6 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -350,14 +350,14 @@ namespace {
 
     bool shouldExplore(Use *U) {
       Instruction *I = cast<Instruction>(U->getUser());
-      if (BeforeHere != I && DT->dominates(BeforeHere, I))
+      if (BeforeHere != I && DT->dominatesUse(BeforeHere, I))
         return false;
       return true;
     }
 
     bool captured(Use *U) {
       Instruction *I = cast<Instruction>(U->getUser());
-      if (BeforeHere != I && DT->dominates(BeforeHere, I))
+      if (BeforeHere != I && DT->dominatesUse(BeforeHere, I))
         return false;
       Captured = true;
       return true;
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index 0f2a634..df5af98 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -858,7 +858,7 @@ bool SCEVExpander::isNormalAddRecExprPHI(PHINode *PN, Instruction *IncV,
     for (User::op_iterator OI = IncV->op_begin()+1,
            OE = IncV->op_end(); OI != OE; ++OI)
       if (Instruction *OInst = dyn_cast<Instruction>(OI))
-        if (!SE.DT->dominates(OInst, IVIncInsertPos))
+        if (!SE.DT->dominatesUse(OInst, IVIncInsertPos))
           return false;
   }
   // Advance to the next instruction.
@@ -1044,7 +1044,7 @@ SCEVExpander::getAddRecExprPHILiterally(const SCEVAddRecExpr *Normalized,
           continue;
         if (L == IVIncInsertLoop)
           do {
-            if (SE.DT->dominates(IncV, IVIncInsertPos))
+            if (SE.DT->dominatesUse(IncV, IVIncInsertPos))
               break;
             // Make sure the increment is where we want it. But don't move it
             // down past a potential existing post-inc user.
@@ -1202,8 +1202,8 @@ Value *SCEVExpander::expandAddRecExprLiterally(const SCEVAddRecExpr *S) {
     // expandCodeFor with an InsertPoint that is either outside the PostIncLoop
     // or dominated by IVIncInsertPos.
     if (isa<Instruction>(Result)
-        && !SE.DT->dominates(cast<Instruction>(Result),
-                             Builder.GetInsertPoint())) {
+        && !SE.DT->dominatesUse(cast<Instruction>(Result),
+                                Builder.GetInsertPoint())) {
       // The induction variable's postinc expansion does not dominate this use.
       // IVUsers tries to prevent this case, so it is rare. However, it can
       // happen when an IVUser outside the loop is not dominated by the latch
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index 5b95f5b..e4bb653 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -1494,7 +1494,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI) {
         // "Hot" Instruction is in some loop (because it dominates its dep.
         // instruction).
         if (Instruction *I = dyn_cast<Instruction>(AV.getSimpleValue()))
-          if (DT->dominates(LI, I)) {
+          if (DT->dominatesUse(LI, I)) {
             isHot = true;
             break;
           }
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index d1e57e1..8f250e3 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -221,7 +221,7 @@ static Instruction *getInsertPointForUses(Instruction *User, Value *Def,
   }
   assert(InsertPt && "Missing phi operand");
   assert((!isa<Instruction>(Def) ||
-          DT->dominates(cast<Instruction>(Def), InsertPt)) &&
+          DT->dominatesUse(cast<Instruction>(Def), InsertPt)) &&
          "def does not dominate all uses");
   return InsertPt;
 }
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 6768860..525d4a7 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -4113,14 +4113,14 @@ LSRInstance::HoistInsertPosition(BasicBlock::iterator IP,
     for (SmallVectorImpl<Instruction *>::const_iterator I = Inputs.begin(),
          E = Inputs.end(); I != E; ++I) {
       Instruction *Inst = *I;
-      if (Inst == Tentative || !DT.dominates(Inst, Tentative)) {
+      if (Inst == Tentative || !DT.dominatesUse(Inst, Tentative)) {
         AllDominate = false;
         break;
       }
       // Attempt to find an insert position in the middle of the block,
       // instead of at the end, so that it can be used for other expansions.
       if (IDom == Inst->getParent() &&
-          (!BetterPos || DT.dominates(BetterPos, Inst)))
+          (!BetterPos || DT.dominatesUse(BetterPos, Inst)))
         BetterPos = llvm::next(BasicBlock::iterator(Inst));
     }
     if (!AllDominate)
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index a87cce3..bc9c631 100644
--- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -654,7 +654,7 @@ bool MemCpyOpt::performCallSlotOptzn(Instruction *cpy,
   // that what would be the new parameter dominates the callsite.
   DominatorTree &DT = getAnalysis<DominatorTree>();
   if (Instruction *cpyDestInst = dyn_cast<Instruction>(cpyDest))
-    if (!DT.dominates(cpyDestInst, C))
+    if (!DT.dominatesUse(cpyDestInst, C))
       return false;
 
   // In addition to knowing that the call does not access src in some
diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp
index dd3e758..2205bdd 100644
--- a/lib/Transforms/Scalar/ObjCARC.cpp
+++ b/lib/Transforms/Scalar/ObjCARC.cpp
@@ -3996,7 +3996,7 @@ bool ObjCARCContract::runOnFunction(Function &F) {
         unsigned OperandNo = UI.getOperandNo();
         ++UI; // Increment UI now, because we may unlink its element.
         if (Instruction *UserInst = dyn_cast<Instruction>(U.getUser()))
-          if (Inst != UserInst && DT->dominates(Inst, UserInst)) {
+          if (Inst != UserInst && DT->dominatesUse(Inst, UserInst)) {
             Changed = true;
             Instruction *Replacement = Inst;
             Type *UseTy = U.get()->getType();
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp
index d052f24..3dd192f 100644
--- a/lib/VMCore/Dominators.cpp
+++ b/lib/VMCore/Dominators.cpp
@@ -80,9 +80,10 @@ void DominatorTree::print(raw_ostream &OS, const Module *) const {
   DT->print(OS);
 }
 
-// dominates - Return true if A dominates a use in B. This performs the
+// dominatesUse - Return true if A dominates a use in B. This performs the
 // special checks necessary if A and B are in the same basic block.
-bool DominatorTree::dominates(const Instruction *A, const Instruction *B) const{
+bool DominatorTree::dominatesUse(const Instruction *A,
+                                 const Instruction *B) const {
   const BasicBlock *BBA = A->getParent(), *BBB = B->getParent();
 
   // If A is an invoke instruction, its value is only available in this normal
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 066c2e7..14ec9e3 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -1648,7 +1648,7 @@ void Verifier::visitInstruction(Instruction &I) {
         }
 
         // Definition must dominate use unless use is unreachable!
-        Assert2(InstsInThisBlock.count(Op) || DT->dominates(Op, &I) ||
+        Assert2(InstsInThisBlock.count(Op) || DT->dominatesUse(Op, &I) ||
                 !DT->isReachableFromEntry(BB),
                 "Instruction does not dominate all uses!", Op, &I);
       }
-- 
1.7.7.6

