[llvm] [ADT] Use small_buckets() in SmallPtrSetImpl::remove_if (NFC) (PR #153962)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 16 09:09:51 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/153962.diff


1 Files Affected:

- (modified) llvm/include/llvm/ADT/SmallPtrSet.h (+2-1) 


``````````diff
diff --git a/llvm/include/llvm/ADT/SmallPtrSet.h b/llvm/include/llvm/ADT/SmallPtrSet.h
index 0d7fe308a32fb..f55627c6866f7 100644
--- a/llvm/include/llvm/ADT/SmallPtrSet.h
+++ b/llvm/include/llvm/ADT/SmallPtrSet.h
@@ -435,7 +435,8 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
   bool remove_if(UnaryPredicate P) {
     bool Removed = false;
     if (isSmall()) {
-      const void **APtr = CurArray, **E = CurArray + NumEntries;
+      auto Buckets = small_buckets();
+      const void **APtr = Buckets.begin(), **E = Buckets.end();
       while (APtr != E) {
         PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(*APtr));
         if (P(Ptr)) {

``````````

</details>


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


More information about the llvm-commits mailing list