[llvm] Use llvm::bit_ceil (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 22 Jan 2023 22:05:14 +0000 (14:05 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 22 Jan 2023 22:05:14 +0000 (14:05 -0800)
In both of these cases, the arguments to Log2_32_Ceil are known to be
nonzero.

llvm/include/llvm/CodeGen/ValueTypes.h
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

index ca55b7d..af4c8ab 100644 (file)
@@ -388,7 +388,7 @@ namespace llvm {
       unsigned BitWidth = getSizeInBits();
       if (BitWidth <= 8)
         return EVT(MVT::i8);
-      return getIntegerVT(Context, 1 << Log2_32_Ceil(BitWidth));
+      return getIntegerVT(Context, llvm::bit_ceil(BitWidth));
     }
 
     /// Finds the smallest simple value type that is greater than or equal to
index b4a82e9..5dca792 100644 (file)
@@ -4104,7 +4104,7 @@ SDValue SystemZTargetLowering::lowerCTPOP(SDValue Op,
 
   // Skip known-zero high parts of the operand.
   int64_t OrigBitSize = VT.getSizeInBits();
-  int64_t BitSize = (int64_t)1 << Log2_32_Ceil(NumSignificantBits);
+  int64_t BitSize = llvm::bit_ceil(NumSignificantBits);
   BitSize = std::min(BitSize, OrigBitSize);
 
   // The POPCNT instruction counts the number of bits in each byte.