[llvm] 82aeedc - [InstCombine] Remove unnecessary eq/ne handling from processUMulZExtIdiom() (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 02:18:52 PDT 2023


Author: Nikita Popov
Date: 2023-10-25T11:18:44+02:00
New Revision: 82aeedc852430d4ea8e97203fc00c2a7e7595bc7

URL: https://github.com/llvm/llvm-project/commit/82aeedc852430d4ea8e97203fc00c2a7e7595bc7
DIFF: https://github.com/llvm/llvm-project/commit/82aeedc852430d4ea8e97203fc00c2a7e7595bc7.diff

LOG: [InstCombine] Remove unnecessary eq/ne handling from processUMulZExtIdiom() (NFCI)

The eq/ne pattern being matched will get canonicalized to the
ugt/ult form.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index fcf69f6171a6435..1b5c4b1ffd7f809 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5875,25 +5875,6 @@ static Instruction *processUMulZExtIdiom(ICmpInst &I, Value *MulVal,
 
   // Recognize patterns
   switch (I.getPredicate()) {
-  case ICmpInst::ICMP_EQ:
-  case ICmpInst::ICMP_NE:
-    // Recognize pattern:
-    //   mulval = mul(zext A, zext B)
-    //   cmp eq/neq mulval, and(mulval, mask), mask selects low MulWidth bits.
-    ConstantInt *CI;
-    Value *ValToMask;
-    if (match(OtherVal, m_And(m_Value(ValToMask), m_ConstantInt(CI)))) {
-      if (ValToMask != MulVal)
-        return nullptr;
-      const APInt &CVal = CI->getValue() + 1;
-      if (CVal.isPowerOf2()) {
-        unsigned MaskWidth = CVal.logBase2();
-        if (MaskWidth == MulWidth)
-          break; // Recognized
-      }
-    }
-    return nullptr;
-
   case ICmpInst::ICMP_UGT:
     // Recognize pattern:
     //   mulval = mul(zext A, zext B)
@@ -5969,11 +5950,6 @@ static Instruction *processUMulZExtIdiom(ICmpInst &I, Value *MulVal,
   // depending on predicate.
   bool Inverse = false;
   switch (I.getPredicate()) {
-  case ICmpInst::ICMP_NE:
-    break;
-  case ICmpInst::ICMP_EQ:
-    Inverse = true;
-    break;
   case ICmpInst::ICMP_UGT:
     if (I.getOperand(0) == MulVal)
       break;


        


More information about the llvm-commits mailing list