[llvm] 8e317e6 - [InstCombine] Remove dead code from foldICmpShlOne. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 15 19:11:07 PST 2023


Author: Craig Topper
Date: 2023-01-15T19:10:17-08:00
New Revision: 8e317e693a6c131391ee8ebc4321e907329b20ba

URL: https://github.com/llvm/llvm-project/commit/8e317e693a6c131391ee8ebc4321e907329b20ba
DIFF: https://github.com/llvm/llvm-project/commit/8e317e693a6c131391ee8ebc4321e907329b20ba.diff

LOG: [InstCombine] Remove dead code from foldICmpShlOne. NFC

This code handles (icmp eq/ne (1 << Y), C) if C is a power of 2.

This case is also handled by the more general foldICmpShlConstConst
which is called before we reach foldICmpShlOne.

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 6571c07ec752..5584332eb18e 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2057,8 +2057,6 @@ static Instruction *foldICmpShlOne(ICmpInst &Cmp, Instruction *Shl,
     // Exclude signed min by subtracting 1 and lower the upper bound to 0.
     if (Pred == ICmpInst::ICMP_SLT && (C-1).sle(0))
       return new ICmpInst(ICmpInst::ICMP_EQ, Y, BitWidthMinusOne);
-  } else if (Cmp.isEquality() && CIsPowerOf2) {
-    return new ICmpInst(Pred, Y, ConstantInt::get(ShiftType, C.logBase2()));
   }
 
   return nullptr;


        


More information about the llvm-commits mailing list