[llvm] [DenseMap] Store occupancy in a packed used-bit array (PR #201281)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 21:14:05 PDT 2026


================
@@ -766,8 +835,10 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
   // Lift some types from the dependent base class into this class for
   // simplicity of referring to them.
   using BaseT = DenseMapBase<DenseMap, KeyT, ValueT, KeyInfoT, BucketT>;
+  using UsedT = llvm::densemap::detail::UsedT;
 
   BucketT *Buckets = nullptr;
+  UsedT *Used = nullptr;
----------------
MaskRay wrote:

Yes. Removing the cached `Used` leads to performance regression:
https://llvm-compile-time-tracker.com/compare.php?from=99ed5a3e9ca762c53b7a4934e10130fa3cd5f674&to=f4ed01d68dfa909ed045f92feece64fb23332233&stat=instructions:u

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


More information about the llvm-commits mailing list