summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit1bedac9af0f8958eef3e6c58a5330e1aa4c8484f (patch)
tree2505ed5c97a8421b36bb356d74d8c9f6f5815070 /llvm
parent25b151dfdf66c7950df49640402283a916936706 (diff)
downloadbcm5719-llvm-1bedac9af0f8958eef3e6c58a5330e1aa4c8484f.tar.gz
bcm5719-llvm-1bedac9af0f8958eef3e6c58a5330e1aa4c8484f.zip
Fix a bug that clobbered the step value on some inputs
llvm-svn: 1416
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Analysis/InductionVariable.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/InductionVariable.cpp b/llvm/lib/Analysis/InductionVariable.cpp
index a340a771963..d88c9cfc683 100644
--- a/llvm/lib/Analysis/InductionVariable.cpp
+++ b/llvm/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));
}
}
OpenPOWER on IntegriCloud