diff options
author | Chris Lattner <sabre@nondot.org> | 2007-11-23 08:46:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-11-23 08:46:22 +0000 |
commit | a8fbde3f783fa716252f086639c8027577294b44 (patch) | |
tree | b7cf472d1076e91f67aae1ac27b255a24e585578 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 9fcdc52243117f1da9b0cb0f69da84ae60f7f11f (diff) | |
download | bcm5719-llvm-a8fbde3f783fa716252f086639c8027577294b44.tar.gz bcm5719-llvm-a8fbde3f783fa716252f086639c8027577294b44.zip |
Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type. This fixes
PR1814.
llvm-svn: 44286
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index cc6cde2ba21..1508fd0c524 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -1470,6 +1470,9 @@ static uint32_t GetMinTrailingZeros(SCEVHandle S) { /// Analyze the expression. /// SCEVHandle ScalarEvolutionsImpl::createSCEV(Value *V) { + if (!isa<IntegerType>(V->getType())) + return SE.getUnknown(V); + if (Instruction *I = dyn_cast<Instruction>(V)) { switch (I->getOpcode()) { case Instruction::Add: @@ -2076,6 +2079,11 @@ SCEVHandle ScalarEvolutionsImpl::getSCEVAtScope(SCEV *V, const Loop *L) { if (Constant *C = dyn_cast<Constant>(Op)) { Operands.push_back(C); } else { + // If any of the operands is non-constant and if they are + // non-integer, don't even try to analyze them with scev techniques. + if (!isa<IntegerType>(Op->getType())) + return V; + SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L); if (SCEVConstant *SC = dyn_cast<SCEVConstant>(OpV)) Operands.push_back(ConstantExpr::getIntegerCast(SC->getValue(), |