[llvm] 4d2009c - [X86] FindSingleBitChange - use m_SpecificInt directly when peeking through shiftmasks

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 10:41:27 PDT 2024


Author: Simon Pilgrim
Date: 2024-08-08T18:41:08+01:00
New Revision: 4d2009cdc7f5af9609e4dfec30db625db1a6cd5b

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

LOG: [X86] FindSingleBitChange - use m_SpecificInt directly when peeking through shiftmasks

No change in poison/undef detection

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 2891e21be1b26..4800b2bdf011a 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -30578,13 +30578,12 @@ static std::pair<Value *, BitTestKind> FindSingleBitChange(Value *V) {
 
       Value *BitV = I->getOperand(1);
 
+      // Read past a shiftmask instruction to find count
       Value *AndOp;
-      const APInt *AndC;
-      if (match(BitV, m_c_And(m_Value(AndOp), m_APInt(AndC)))) {
-        // Read past a shiftmask instruction to find count
-        if (*AndC == (I->getType()->getPrimitiveSizeInBits() - 1))
-          BitV = AndOp;
-      }
+      uint64_t ShiftMask = I->getType()->getPrimitiveSizeInBits() - 1;
+      if (match(BitV, m_c_And(m_Value(AndOp), m_SpecificInt(ShiftMask))))
+        BitV = AndOp;
+
       return {BitV, BTK};
     }
   }


        


More information about the llvm-commits mailing list