[llvm-branch-commits] [llvm] [CodeGen] LiveIntervalUnions::Array Implement move constructor (PR #111357)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Oct 7 03:30:18 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-regalloc
Author: Akshat Oke (Akshat-Oke)
<details>
<summary>Changes</summary>
Solves the double free error.
---
Full diff: https://github.com/llvm/llvm-project/pull/111357.diff
1 Files Affected:
- (modified) llvm/include/llvm/CodeGen/LiveIntervalUnion.h (+7)
``````````diff
diff --git a/llvm/include/llvm/CodeGen/LiveIntervalUnion.h b/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
index 81003455da4241..cc0f2a45bb182c 100644
--- a/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
+++ b/llvm/include/llvm/CodeGen/LiveIntervalUnion.h
@@ -176,6 +176,13 @@ class LiveIntervalUnion {
Array() = default;
~Array() { clear(); }
+ Array(Array &&Other) : Size(Other.Size), LIUs(Other.LIUs) {
+ Other.Size = 0;
+ Other.LIUs = nullptr;
+ }
+
+ Array(const Array &) = delete;
+
// Initialize the array to have Size entries.
// Reuse an existing allocation if the size matches.
void init(LiveIntervalUnion::Allocator&, unsigned Size);
``````````
</details>
https://github.com/llvm/llvm-project/pull/111357
More information about the llvm-branch-commits
mailing list