[llvm] 0c783be - [TargetLowering] Use APInt::isSubsetOf to simplify an expression. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 22:10:00 PDT 2024


Author: Craig Topper
Date: 2024-08-09T22:09:40-07:00
New Revision: 0c783be98549b23bb2ccd3df6d407740e16cc1e1

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

LOG: [TargetLowering] Use APInt::isSubsetOf to simplify an expression. NFC

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index db8a64c52ecf66..b16bf3a8ec7784 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -5145,7 +5145,7 @@ SDValue TargetLowering::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
           N0.getOpcode() == ISD::AND && N0.hasOneUse()) {
         if (auto *AndRHS = dyn_cast<ConstantSDNode>(N0.getOperand(1))) {
           const APInt &AndRHSC = AndRHS->getAPIntValue();
-          if (AndRHSC.isNegatedPowerOf2() && (AndRHSC & C1) == C1) {
+          if (AndRHSC.isNegatedPowerOf2() && C1.isSubsetOf(AndRHSC)) {
             unsigned ShiftBits = AndRHSC.countr_zero();
             if (!TLI.shouldAvoidTransformToShift(ShValTy, ShiftBits)) {
               SDValue Shift = DAG.getNode(


        


More information about the llvm-commits mailing list