summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-12-03 17:27:42 +0000
committerChris Lattner <sabre@nondot.org>2001-12-03 17:27:42 +0000
commit66d9ceaaba94e31365008ae04149e6d8c2a324f8 (patch)
tree27fbb58eb4704f1674285b5eab1392acbf2a02d5 /llvm/lib/Analysis
parentb4c677745e94fc750c795de2f2b662f9391dd22b (diff)
downloadbcm5719-llvm-66d9ceaaba94e31365008ae04149e6d8c2a324f8.tar.gz
bcm5719-llvm-66d9ceaaba94e31365008ae04149e6d8c2a324f8.zip
Induction variables must be phi nodes
llvm-svn: 1402
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InductionVariable.cpp9
1 files changed, 4 insertions, 5 deletions
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<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...
OpenPOWER on IntegriCloud