From 66d9ceaaba94e31365008ae04149e6d8c2a324f8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 3 Dec 2001 17:27:42 +0000 Subject: Induction variables must be phi nodes llvm-svn: 1402 --- llvm/lib/Analysis/InductionVariable.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Analysis') diff --git a/llvm/lib/Analysis/InductionVariable.cpp b/llvm/lib/Analysis/InductionVariable.cpp index 706c778a4da..b64daa25b30 100644 --- a/llvm/lib/Analysis/InductionVariable.cpp +++ b/llvm/lib/Analysis/InductionVariable.cpp @@ -59,15 +59,14 @@ InductionVariable::Classify(const Value *Start, const Value *Step, // 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(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... -- cgit v1.2.3