diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-10-14 09:38:46 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-10-14 09:38:46 +0000 |
commit | 4c7f1caadc6fdad54dd9f502224236f7e73cc6a8 (patch) | |
tree | 751bf645e44f8d8bd0ed1895420bb4d947872db8 /lib | |
parent | 54a11176f6a5e07e243f1d87ba19ac3f4681976b (diff) |
An instruction's operands aren't necessarily instructions or constants. They
could be arguments, for example.
No testcase because this is a bug-fix broken out of a larger optimization patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141951 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index f09f357c61..e0ac56c65e 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -4764,7 +4764,8 @@ static Constant *EvaluateExpression(Value *V, const Loop *L, for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { Instruction *Operand = dyn_cast<Instruction>(I->getOperand(i)); if (!Operand) { - Operands[i] = cast<Constant>(I->getOperand(i)); + Operands[i] = dyn_cast<Constant>(I->getOperand(i)); + if (!Operands[i]) return 0; continue; } Constant *C = EvaluateExpression(Operand, L, Vals, TD); |