[llvm] [ADT] Move the core logic of swapping to DenseMapBase::swap (NFC) (PR #168486)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 03:24:52 PST 2025


================
@@ -424,6 +433,43 @@ class DenseMapBase : public DebugEpochBase {
     return NextPowerOf2(NumEntries * 4 / 3 + 1);
   }
 
+  // Move buckets without rehash.
+  //
+  // Preconditions:
+  // - *this is killed.
+  // - RHS is valid.
+  //
+  // Post conditions:
+  // - *this is valid.
+  // - RHS is valid or killed (but not uninitialized).
+  void moveWithoutRehash(DerivedT &&RHS) {
+    if (derived().maybeMoveFast(std::move(RHS.derived())))
----------------
s-barannikov wrote:

```suggestion
    if (derived().maybeMoveFast(std::move(RHS)))
```

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


More information about the llvm-commits mailing list