[llvm] r311528 - [InstCombine] Replace a simple matcher with a plain old dyn_cast. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 22 22:46:08 PDT 2017


Author: ctopper
Date: Tue Aug 22 22:46:08 2017
New Revision: 311528

URL: http://llvm.org/viewvc/llvm-project?rev=311528&view=rev
Log:
[InstCombine] Replace a simple matcher with a plain old dyn_cast. NFC

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=311528&r1=311527&r2=311528&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Tue Aug 22 22:46:08 2017
@@ -2524,8 +2524,7 @@ Instruction *InstCombiner::foldICmpInstW
   if (!match(Cmp.getOperand(1), m_APInt(C)))
     return nullptr;
 
-  BinaryOperator *BO;
-  if (match(Cmp.getOperand(0), m_BinOp(BO))) {
+  if (auto *BO = dyn_cast<BinaryOperator>(Cmp.getOperand(0))) {
     switch (BO->getOpcode()) {
     case Instruction::Xor:
       if (Instruction *I = foldICmpXorConstant(Cmp, BO, C))




More information about the llvm-commits mailing list