From 9283e246850d5acc1d1b9773d288e6d990845c34 Mon Sep 17 00:00:00 2001 From: Vladislav Dzhidzhoev Date: Thu, 15 May 2025 10:33:44 +0200 Subject: [PATCH] [DebugInfo] Drop extra DIBuilder::finalizeSubprogram() calls (NFC) After #139914, `DIBilder::finalize()` finalizes both declaration and definition DISubprograms. Therefore, there is no need to call `DIBuilder::finalizeSubprogram()` right before `DIBilder::finalize()`. --- llvm/lib/CodeGen/MachineOutliner.cpp | 3 --- llvm/lib/Transforms/IPO/IROutliner.cpp | 3 --- llvm/lib/Transforms/Utils/Debugify.cpp | 1 - 3 files changed, 7 deletions(-) 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();