make this a static function instead of a method.
authorChris Lattner <sabre@nondot.org>
Tue, 5 Jan 2010 22:30:42 +0000 (22:30 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 5 Jan 2010 22:30:42 +0000 (22:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92795 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombine.h
lib/Transforms/InstCombine/InstCombineCasts.cpp

index e6ad1c73c25256e9d537f89a64c59289011f9969..136bb885e51333854e5d7b062ba3d82d0ab079ec 100644 (file)
@@ -338,8 +338,6 @@ private:
 
   Value *EvaluateInDifferentType(Value *V, const Type *Ty, bool isSigned);
 
-  bool CanEvaluateInDifferentType(Value *V, const Type *Ty,
-                                  unsigned CastOpc, int &NumCastsRemoved);
   unsigned GetOrEnforceKnownAlignment(Value *V,
                                       unsigned PrefAlign = 0);
 
index 52c36ddd3fe7009468061cd9b95e090f02db2d04..c5ddec8b75138d34b637681c6dfefc1891364701 100644 (file)
@@ -165,9 +165,8 @@ Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
 /// If CastOpc is a sext or zext, we are asking if the low bits of the value can
 /// bit computed in a larger type, which is then and'd or sext_in_reg'd to get
 /// the final result.
-bool InstCombiner::CanEvaluateInDifferentType(Value *V, const Type *Ty,
-                                              unsigned CastOpc,
-                                              int &NumCastsRemoved){
+static bool CanEvaluateInDifferentType(Value *V, const Type *Ty,
+                                       unsigned CastOpc, int &NumCastsRemoved) {
   // We can always evaluate constants in another type.
   if (isa<Constant>(V))
     return true;
@@ -274,7 +273,9 @@ bool InstCombiner::CanEvaluateInDifferentType(Value *V, const Type *Ty,
                                       NumCastsRemoved);
   }
   case Instruction::PHI: {
-    // We can change a phi if we can change all operands.
+    // We can change a phi if we can change all operands.  Note that we never
+    // get into trouble with cyclic PHIs here because we only consider
+    // instructions with a single use.
     PHINode *PN = cast<PHINode>(I);
     for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
       if (!CanEvaluateInDifferentType(PN->getIncomingValue(i), Ty, CastOpc,