Skip to content

Conversation

SLTozer
Copy link
Contributor

@SLTozer SLTozer commented Sep 16, 2025

Fixes an issue in commit 3946c50, PR #135349.

The DebugSSAUpdater class performs raw pointer allocations. It frees these properly in reset(), but does not do so in its destructor - as an immediate fix, this patch adds a destructor which frees the allocations correctly.

I'll be merging this immediately to fix the issue, but will be open to post-commit review and/or producing a better fix in a follow-up commit.

Fixes an issue in commit 3946c50, PR llvm#135349.

The DebugSSAUpdater class performs raw pointer allocations. It frees these
properly in reset(), but does not do so in its destructor - as an immediate
fix, this patch adds a destructor which frees the allocations correctly.
@llvmbot
Copy link
Member

llvmbot commented Sep 16, 2025

@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-debuginfo

Author: Stephen Tozer (SLTozer)

Changes

Fixes an issue in commit 3946c50, PR #135349.

The DebugSSAUpdater class performs raw pointer allocations. It frees these properly in reset(), but does not do so in its destructor - as an immediate fix, this patch adds a destructor which frees the allocations correctly.

I'll be merging this immediately to fix the issue, but will be open to post-commit review and/or producing a better fix in a follow-up commit.


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

1 Files Affected:

  • (modified) llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h (+5)
diff --git a/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h b/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h
index 90899c86f5c3b..2d25ce3245793 100644
--- a/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h
+++ b/llvm/include/llvm/Transforms/Utils/DebugSSAUpdater.h
@@ -235,6 +235,11 @@ class DebugSSAUpdater {
   DebugSSAUpdater(const DebugSSAUpdater &) = delete;
   DebugSSAUpdater &operator=(const DebugSSAUpdater &) = delete;
 
+  ~DebugSSAUpdater() {
+    for (auto &Block : BlockMap)
+      delete Block.second;
+  }
+
   void reset() {
     for (auto &Block : BlockMap)
       delete Block.second;

@SLTozer SLTozer merged commit a42aac5 into llvm:main Sep 16, 2025
10 of 12 checks passed
@SLTozer SLTozer added the skip-precommit-approval PR for CI feedback, not intended for review label Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debuginfo llvm:transforms skip-precommit-approval PR for CI feedback, not intended for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants