diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-10-13 23:28:31 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-10-13 23:28:31 +0000 |
commit | 16e7ff171bce9d10e684c5ad1c928242078fcccc (patch) | |
tree | 7be95d82305f92796642aee4d961ed88f27021a6 /llvm/lib | |
parent | 3a43754329bfd08939e43fc8642e8902ef32f103 (diff) | |
download | bcm5719-llvm-16e7ff171bce9d10e684c5ad1c928242078fcccc.tar.gz bcm5719-llvm-16e7ff171bce9d10e684c5ad1c928242078fcccc.zip |
[SCEV] Use `SCEV::isAllOnesValue` directly; NFC.
Instead of `dyn_cast` ing to `SCEVConstant` and checking the contained
`ConstantInteger.
llvm-svn: 250251
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index a1a4f2501fa..7d52ca759d8 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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<SCEVAddExpr>(Expr); - if (!Add || Add->getNumOperands() != 2) return nullptr; - - const SCEVConstant *AddLHS = dyn_cast<SCEVConstant>(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<SCEVMulExpr>(Add->getOperand(1)); - if (!AddRHS || AddRHS->getNumOperands() != 2) return nullptr; - - const SCEVConstant *MulLHS = dyn_cast<SCEVConstant>(AddRHS->getOperand(0)); - if (!(MulLHS && MulLHS->getValue()->getValue().isAllOnesValue())) + if (!AddRHS || AddRHS->getNumOperands() != 2 || + !AddRHS->getOperand(0)->isAllOnesValue()) return nullptr; return AddRHS->getOperand(1); |