[llvm] [ADT] Fix the initial size calculation of SmallDenseMap (PR #158458)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 14 04:54:34 PDT 2025


================
@@ -905,7 +901,7 @@ class SmallDenseMap
 
   template <typename InputIt>
   SmallDenseMap(const InputIt &I, const InputIt &E) {
-    init(NextPowerOf2(std::distance(I, E)));
+    init(std::distance(I, E));
----------------
kuhar wrote:

BTW, this is potentially expensive for forward iterators... Nothing to do with this PR though 

https://github.com/llvm/llvm-project/pull/158458


More information about the llvm-commits mailing list