[InstCombine] Use dyn_cast instead of match(m_Constant). NFC

llvm-svn: 341962
This commit is contained in:
Craig Topper 2018-09-11 16:51:26 +00:00
parent a57bb61a3e
commit 12fd6bd4ad
1 changed files with 2 additions and 4 deletions

View File

@ -1195,8 +1195,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
// integer add followed by a sext.
if (SExtInst *LHSConv = dyn_cast<SExtInst>(LHS)) {
// (add (sext x), cst) --> (sext (add x, cst'))
Constant *RHSC;
if (match(RHS, m_Constant(RHSC))) {
if (auto *RHSC = dyn_cast<Constant>(RHS)) {
if (LHSConv->hasOneUse()) {
Constant *CI =
ConstantExpr::getTrunc(RHSC, LHSConv->getOperand(0)->getType());
@ -1232,8 +1231,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
// integer add followed by a zext.
if (auto *LHSConv = dyn_cast<ZExtInst>(LHS)) {
// (add (zext x), cst) --> (zext (add x, cst'))
Constant *RHSC;
if (match(RHS, m_Constant(RHSC))) {
if (auto *RHSC = dyn_cast<Constant>(RHS)) {
if (LHSConv->hasOneUse()) {
Constant *CI =
ConstantExpr::getTrunc(RHSC, LHSConv->getOperand(0)->getType());