[llvm] [ADT] Speed up FoldingSet with linear probing and Algorithm R deletion (PR #218190)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 23 12:06:33 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- llvm/include/llvm/ADT/FoldingSet.h llvm/lib/Support/FoldingSet.cpp llvm/unittests/ADT/FoldingSet.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp
index ba3cb1c5c..4c247d5d6 100644
--- a/llvm/lib/Support/FoldingSet.cpp
+++ b/llvm/lib/Support/FoldingSet.cpp
@@ -148,8 +148,7 @@ FoldingSetBase::FoldingSetBase(unsigned Log2InitSize) {
   assert(5 < Log2InitSize && Log2InitSize < 32 &&
          "Initial hash table size out of range");
   NumBuckets = 1 << Log2InitSize;
-  Buckets = static_cast<void **>(
-      safe_calloc(NumBuckets, sizeof(void *)));
+  Buckets = static_cast<void **>(safe_calloc(NumBuckets, sizeof(void *)));
 }
 
 FoldingSetBase::FoldingSetBase(FoldingSetBase &&Arg)

``````````

</details>


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


More information about the llvm-commits mailing list