[llvm] e387f49 - [InstCombine] Remove deadcode in `(icmp SignTest(shl/shr X))`; NFC

Noah Goldstein via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 13:14:23 PDT 2023


Author: Noah Goldstein
Date: 2023-06-06T15:14:10-05:00
New Revision: e387f49d133de0e43c390ea3b7020a7decd2eed3

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

LOG: [InstCombine] Remove deadcode in `(icmp SignTest(shl/shr X))`; NFC

This is dead as of: D145341

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D152181

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 e80d69c77545e..0865de3d39893 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2251,11 +2251,6 @@ Instruction *InstCombinerImpl::foldICmpShlConstant(ICmpInst &Cmp,
       APInt ShiftedC = (C - 1).ashr(*ShiftAmt) + 1;
       return new ICmpInst(Pred, X, ConstantInt::get(ShType, ShiftedC));
     }
-    // If this is a signed comparison to 0 and the shift is sign preserving,
-    // use the shift LHS operand instead; isSignTest may change 'Pred', so only
-    // do that if we're sure to not continue on in this function.
-    if (isSignTest(Pred, C))
-      return new ICmpInst(Pred, X, Constant::getNullValue(ShType));
   }
 
   // NUW guarantees that we are only shifting out zero bits from the high bits,


        


More information about the llvm-commits mailing list