[llvm] 1738d04 - [Support] Use llvm::bit_ceil (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 29 16:07:11 PST 2023
Author: Kazu Hirata
Date: 2023-01-29T16:07:04-08:00
New Revision: 1738d046631aed29c2ce7e3b1e79c1ba81eef27d
URL: https://github.com/llvm/llvm-project/commit/1738d046631aed29c2ce7e3b1e79c1ba81eef27d
DIFF: https://github.com/llvm/llvm-project/commit/1738d046631aed29c2ce7e3b1e79c1ba81eef27d.diff
LOG: [Support] Use llvm::bit_ceil (NFC)
For nonzero X, NextPowerOf2(X) is equivalent to llvm::bit_ceil(X + 1).
Added:
Modified:
llvm/include/llvm/Support/OnDiskHashTable.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/OnDiskHashTable.h b/llvm/include/llvm/Support/OnDiskHashTable.h
index 07ee8e79423ba..bb90d8fc3ac7d 100644
--- a/llvm/include/llvm/Support/OnDiskHashTable.h
+++ b/llvm/include/llvm/Support/OnDiskHashTable.h
@@ -163,7 +163,7 @@ template <typename Info> class OnDiskChainedHashTableGenerator {
//
// FIXME: Try computing a perfect hash function at this point.
unsigned TargetNumBuckets =
- NumEntries <= 2 ? 1 : NextPowerOf2(NumEntries * 4 / 3);
+ NumEntries <= 2 ? 1 : llvm::bit_ceil(NumEntries * 4 / 3 + 1);
if (TargetNumBuckets != NumBuckets)
resize(TargetNumBuckets);
More information about the llvm-commits
mailing list