From 610fc64d7892148f1c91fa954283dc0fe0759ada Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Fri, 14 Oct 2011 09:38:46 +0000 Subject: [PATCH] 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 --- lib/Analysis/ScalarEvolution.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index f09f357c61c..e0ac56c65e7 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(I->getOperand(i)); if (!Operand) { - Operands[i] = cast(I->getOperand(i)); + Operands[i] = dyn_cast(I->getOperand(i)); + if (!Operands[i]) return 0; continue; } Constant *C = EvaluateExpression(Operand, L, Vals, TD);