summaryrefslogtreecommitdiff
path: root/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
commitdf89f6efbc5d2b40b4997a84ae12ab86baa2d9cb (patch)
tree2a95672a7250e3a73a624e4b7df4db6d745f62f2 /lib/Analysis
parentf60dc88b3dc771c8dfbb5c6958666804af2fe032 (diff)
downloadllvm-df89f6efbc5d2b40b4997a84ae12ab86baa2d9cb.tar.gz
llvm-df89f6efbc5d2b40b4997a84ae12ab86baa2d9cb.tar.bz2
llvm-df89f6efbc5d2b40b4997a84ae12ab86baa2d9cb.tar.xz
Induction variables must be phi nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/InductionVariable.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Analysis/InductionVariable.cpp b/lib/Analysis/InductionVariable.cpp
index 706c778a4d..b64daa25b3 100644
--- a/lib/Analysis/InductionVariable.cpp
+++ b/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...