Induction variables must be phi nodes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1402 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/InductionVariable.cpp b/lib/Analysis/InductionVariable.cpp
index 706c778..b64daa2 100644
--- a/lib/Analysis/InductionVariable.cpp
+++ b/lib/Analysis/InductionVariable.cpp
@@ -59,15 +59,14 @@
 // Create an induction variable for the specified value.  If it is a PHI, and
 // if it's recognizable, classify it and fill in instance variables.
 //
-InductionVariable::InductionVariable(Instruction *V, cfg::LoopInfo *LoopInfo) {
+InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
   InductionType = Unknown;     // Assume the worst
+  Phi = P;
   
-  // If this instruction is not a PHINode, it can't be an induction variable.
-  // Also, if the PHI node has more than two predecessors, we don't know how to
+  // If the PHI node has more than two predecessors, we don't know how to
   // handle it.
   //
-  Phi = dyn_cast<PHINode>(V);
-  if (!Phi || Phi->getNumIncomingValues() != 2) return;
+  if (Phi->getNumIncomingValues() != 2) return;
 
   // If we have loop information, make sure that this PHI node is in the header
   // of a loop...