[DebugInfo] Drop extra DIBuilder::finalizeSubprogram() calls (NFC)#155618
Merged
dzhidzhoev merged 1 commit intollvm:mainfrom Aug 27, 2025
Merged
[DebugInfo] Drop extra DIBuilder::finalizeSubprogram() calls (NFC)#155618dzhidzhoev merged 1 commit intollvm:mainfrom
dzhidzhoev merged 1 commit intollvm:mainfrom
Conversation
After llvm#139914, `DIBilder::finalize()` finalizes both declaration and definition DISubprograms. Therefore, there is no need to call `DIBuilder::finalizeSubprogram()` right before `DIBilder::finalize()`.
Member
|
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-debuginfo Author: Vladislav Dzhidzhoev (dzhidzhoev) ChangesAfter #139914, 3 Files Affected:
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index b0bce2c21a470..c7f09d577c4fa 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1017,9 +1017,6 @@ MachineFunction *MachineOutliner::createOutlinedFunction(
/* Outlined code is optimized code by definition. */
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
- // Don't add any new variables to the subprogram.
- DB.finalizeSubprogram(OutlinedSP);
-
// Attach subprogram to the function.
F->setSubprogram(OutlinedSP);
// We're done with the DIBuilder.
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index c57981ae4ca0d..fdf0c3ac8007d 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -686,9 +686,6 @@ Function *IROutliner::createFunction(Module &M, OutlinableGroup &Group,
/* Outlined code is optimized code by definition. */
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
- // Don't add any new variables to the subprogram.
- DB.finalizeSubprogram(OutlinedSP);
-
// Attach subprogram to the function.
F->setSubprogram(OutlinedSP);
// We're done with the DIBuilder.
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index 7063cde5263b4..5a09b7385f2be 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -254,7 +254,6 @@ bool llvm::applyDebugifyMetadata(
}
if (ApplyToMF)
ApplyToMF(DIB, F);
- DIB.finalizeSubprogram(SP);
}
DIB.finalize();
|
jmorse
approved these changes
Aug 27, 2025
Member
jmorse
left a comment
There was a problem hiding this comment.
LGTM; as with the other patch, do keep an eye on whether there's a compile time consequence (it seems very unlikely).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After #139914,
DIBilder::finalize()finalizes both declaration and definition DISubprograms.Therefore, there is no need to call
DIBuilder::finalizeSubprogram()right beforeDIBilder::finalize().