Make sure that we're dealing with a binary SCEVExpr when simplifying.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 30 May 2012 18:42:43 +0000 (18:42 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 30 May 2012 18:42:43 +0000 (18:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157704 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index c45cc8d0f8c4119d5572d98482d408ddc0b4ccf4..b49c65f3706e22766a245dce4900ddcb2437b0e5 100644 (file)
@@ -5654,7 +5654,8 @@ bool ScalarEvolution::SimplifyICmpOperands(ICmpInst::Predicate &Pred,
       if (!RA)
         if (const SCEVAddExpr *AE = dyn_cast<SCEVAddExpr>(LHS))
           if (const SCEVMulExpr *ME = dyn_cast<SCEVMulExpr>(AE->getOperand(0)))
-            if (ME->getOperand(0)->isAllOnesValue()) {
+            if (AE->getNumOperands() == 2 && ME->getNumOperands() == 2 &&
+                ME->getOperand(0)->isAllOnesValue()) {
               RHS = AE->getOperand(1);
               LHS = ME->getOperand(1);
               Changed = true;