1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[SCEV] Use SCEV::isAllOnesValue directly; NFC.

Instead of `dyn_cast` ing to `SCEVConstant` and checking the contained
`ConstantInteger.

llvm-svn: 250251
This commit is contained in:
Sanjoy Das 2015-10-13 23:28:31 +00:00
parent 4b5a0d9544
commit 701aed0a6e

View File

@ -7677,17 +7677,13 @@ bool ScalarEvolution::isImpliedCondOperands(ICmpInst::Predicate Pred,
/// If Expr computes ~A, return A else return nullptr /// If Expr computes ~A, return A else return nullptr
static const SCEV *MatchNotExpr(const SCEV *Expr) { static const SCEV *MatchNotExpr(const SCEV *Expr) {
const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Expr); const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(Expr);
if (!Add || Add->getNumOperands() != 2) return nullptr; if (!Add || Add->getNumOperands() != 2 ||
!Add->getOperand(0)->isAllOnesValue())
const SCEVConstant *AddLHS = dyn_cast<SCEVConstant>(Add->getOperand(0));
if (!(AddLHS && AddLHS->getValue()->getValue().isAllOnesValue()))
return nullptr; return nullptr;
const SCEVMulExpr *AddRHS = dyn_cast<SCEVMulExpr>(Add->getOperand(1)); const SCEVMulExpr *AddRHS = dyn_cast<SCEVMulExpr>(Add->getOperand(1));
if (!AddRHS || AddRHS->getNumOperands() != 2) return nullptr; if (!AddRHS || AddRHS->getNumOperands() != 2 ||
!AddRHS->getOperand(0)->isAllOnesValue())
const SCEVConstant *MulLHS = dyn_cast<SCEVConstant>(AddRHS->getOperand(0));
if (!(MulLHS && MulLHS->getValue()->getValue().isAllOnesValue()))
return nullptr; return nullptr;
return AddRHS->getOperand(1); return AddRHS->getOperand(1);