[llvm-commits] [llvm] r141951 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Nick Lewycky nicholas at mxc.ca
Fri Oct 14 02:38:46 PDT 2011


Author: nicholas
Date: Fri Oct 14 04:38:46 2011
New Revision: 141951

URL: http://llvm.org/viewvc/llvm-project?rev=141951&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=141951&r1=141950&r2=141951&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Oct 14 04:38:46 2011
@@ -4764,7 +4764,8 @@
   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);





More information about the llvm-commits mailing list