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 | a447e0f38f9236a61407ebed49cd16d08ddb3676 (patch) | |
tree | f98a3920727a59f399aba08e8396516a9600b86c /llvm | |
parent | dcaaa21fbe2a30fc3adeb91c1a38fa36b7ab74a3 (diff) | |
download | bcm5719-llvm-a447e0f38f9236a61407ebed49cd16d08ddb3676.tar.gz bcm5719-llvm-a447e0f38f9236a61407ebed49cd16d08ddb3676.zip |
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.
llvm-svn: 141951
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index f09f357c61c..e0ac56c65e7 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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); |