From: Sanjoy Das Date: Tue, 13 Oct 2015 23:28:31 +0000 (+0000) Subject: [SCEV] Use `SCEV::isAllOnesValue` directly; NFC. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=22fe9c561b810a8dcd7899cabfa752560cb835ba;p=oota-llvm.git [SCEV] Use `SCEV::isAllOnesValue` directly; NFC. Instead of `dyn_cast` ing to `SCEVConstant` and checking the contained `ConstantInteger. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250251 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index a1a4f2501fa..7d52ca759d8 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -7677,17 +7677,13 @@ bool ScalarEvolution::isImpliedCondOperands(ICmpInst::Predicate Pred, /// If Expr computes ~A, return A else return nullptr static const SCEV *MatchNotExpr(const SCEV *Expr) { const SCEVAddExpr *Add = dyn_cast(Expr); - if (!Add || Add->getNumOperands() != 2) return nullptr; - - const SCEVConstant *AddLHS = dyn_cast(Add->getOperand(0)); - if (!(AddLHS && AddLHS->getValue()->getValue().isAllOnesValue())) + if (!Add || Add->getNumOperands() != 2 || + !Add->getOperand(0)->isAllOnesValue()) return nullptr; const SCEVMulExpr *AddRHS = dyn_cast(Add->getOperand(1)); - if (!AddRHS || AddRHS->getNumOperands() != 2) return nullptr; - - const SCEVConstant *MulLHS = dyn_cast(AddRHS->getOperand(0)); - if (!(MulLHS && MulLHS->getValue()->getValue().isAllOnesValue())) + if (!AddRHS || AddRHS->getNumOperands() != 2 || + !AddRHS->getOperand(0)->isAllOnesValue()) return nullptr; return AddRHS->getOperand(1);