[llvm] 3c31ee7 - [APInt] Call countTrailingZerosSlowCase() directly from isShiftedMask. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 17 23:16:08 PST 2024


Author: Craig Topper
Date: 2024-11-17T23:11:16-08:00
New Revision: 3c31ee740669fc80ff1bb4ae3724aa778cd1659e

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

LOG: [APInt] Call countTrailingZerosSlowCase() directly from isShiftedMask. NFC

We checked the single word case already and we already call
countLeadingZerosSlowCase and countPopulationSlowCase.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/APInt.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 953b2a27b71526..225390f1af60b3 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -512,7 +512,7 @@ class [[nodiscard]] APInt {
       return isShiftedMask_64(U.VAL);
     unsigned Ones = countPopulationSlowCase();
     unsigned LeadZ = countLeadingZerosSlowCase();
-    return (Ones + LeadZ + countr_zero()) == BitWidth;
+    return (Ones + LeadZ + countTrailingZerosSlowCase()) == BitWidth;
   }
 
   /// Return true if this APInt value contains a non-empty sequence of ones with


        


More information about the llvm-commits mailing list