[llvm] e599094 - [llvm] Use llvm::bit_ceil (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 22 14:05:21 PST 2023
Author: Kazu Hirata
Date: 2023-01-22T14:05:14-08:00
New Revision: e59909403823852d8308e3549ccd911b8994fa13
URL: https://github.com/llvm/llvm-project/commit/e59909403823852d8308e3549ccd911b8994fa13
DIFF: https://github.com/llvm/llvm-project/commit/e59909403823852d8308e3549ccd911b8994fa13.diff
LOG: [llvm] Use llvm::bit_ceil (NFC)
In both of these cases, the arguments to Log2_32_Ceil are known to be
nonzero.
Added:
Modified:
llvm/include/llvm/CodeGen/ValueTypes.h
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/ValueTypes.h b/llvm/include/llvm/CodeGen/ValueTypes.h
index ca55b7d43068..af4c8ab40e82 100644
--- a/llvm/include/llvm/CodeGen/ValueTypes.h
+++ b/llvm/include/llvm/CodeGen/ValueTypes.h
@@ -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
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index b4a82e9094f3..5dca792dc89a 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -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.
More information about the llvm-commits
mailing list