[llvm] r341962 - [InstCombine] Use dyn_cast instead of match(m_Constant). NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 11 09:51:26 PDT 2018
Author: ctopper
Date: Tue Sep 11 09:51:26 2018
New Revision: 341962
URL: http://llvm.org/viewvc/llvm-project?rev=341962&view=rev
Log:
[InstCombine] Use dyn_cast instead of match(m_Constant). NFC
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=341962&r1=341961&r2=341962&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Tue Sep 11 09:51:26 2018
@@ -1195,8 +1195,7 @@ Instruction *InstCombiner::visitAdd(Bina
// 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(Bina
// 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());
More information about the llvm-commits
mailing list