summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-12-05 06:32:30 +0000
committerChris Lattner <sabre@nondot.org>2001-12-05 06:32:30 +0000
commit6de230aca89793a30a9b9a11831fe0b6ec9d7559 (patch)
tree9860c60994924fde722b7ed84a0363e8b64632c7 /lib/Analysis
parented4feac757318b92cecd3d3d1a1c2800d4ef52b3 (diff)
downloadllvm-6de230aca89793a30a9b9a11831fe0b6ec9d7559.tar.gz
llvm-6de230aca89793a30a9b9a11831fe0b6ec9d7559.tar.bz2
llvm-6de230aca89793a30a9b9a11831fe0b6ec9d7559.tar.xz
Fix a bug that clobbered the step value on some inputs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1416 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/InductionVariable.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Analysis/InductionVariable.cpp b/lib/Analysis/InductionVariable.cpp
index a340a77196..d88c9cfc68 100644
--- a/lib/Analysis/InductionVariable.cpp
+++ b/lib/Analysis/InductionVariable.cpp
@@ -69,6 +69,10 @@ InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
//
if (Phi->getNumIncomingValues() != 2) return;
+ // FIXME: Handle FP induction variables.
+ if (Phi->getType() == Type::FloatTy || Phi->getType() == Type::DoubleTy)
+ return;
+
// If we have loop information, make sure that this PHI node is in the header
// of a loop...
//
@@ -140,11 +144,10 @@ InductionVariable::InductionVariable(PHINode *P, cfg::LoopInfo *LoopInfo) {
Step = (Value*)StepE.Offset;
else
Step = Constant::getNullConstant(Step->getType());
+ const Type *ETy = Phi->getType();
+ if (ETy->isPointerType()) ETy = Type::ULongTy;
+ Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy,0));
}
-
- const Type *ETy = Phi->getType();
- if (ETy->isPointerType()) ETy = Type::ULongTy;
- Step = (Value*)(StepE.Offset ? StepE.Offset : ConstantInt::get(ETy, 0));
}
}