From 127563b216eadf756e03f0adf2c3900bf244b504 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 30 May 2012 18:42:43 +0000 Subject: [PATCH] Make sure that we're dealing with a binary SCEVExpr when simplifying. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157704 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 c45cc8d0f8c..b49c65f3706 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -5654,7 +5654,8 @@ bool ScalarEvolution::SimplifyICmpOperands(ICmpInst::Predicate &Pred, if (!RA) if (const SCEVAddExpr *AE = dyn_cast(LHS)) if (const SCEVMulExpr *ME = dyn_cast(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;