From 3e76e6083da3717fafbb2345eb8a5d1bdac3013e Mon Sep 17 00:00:00 2001 From: Jeremy Morse Date: Tue, 20 Feb 2024 16:13:28 +0000 Subject: [DebugInfo][RemoveDIs] Set new-dbg-info flag from Modules correctly (#82373) It turns out there's a pathway for Functions to be inserted into modules without having the "New" debug-info flag set correctly, which this patch fixes. Sadly there isn't a Module::insert method to instrument out there, everyone touches the list directly. This fix exposes a path where such functions are produced in the outliner in the wrong mode; requiring a fix there to correctly drop RemoveDIs-mode debug-info. This is covered by test/DebugInfo/AArch64/ir-outliner.ll --- llvm/lib/IR/Function.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/IR/Function.cpp') diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index fceffbc..056e4f3 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -437,8 +437,10 @@ Function::Function(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, if (Ty->getNumParams()) setValueSubclassData(1); // Set the "has lazy arguments" bit. - if (ParentModule) + if (ParentModule) { ParentModule->getFunctionList().push_back(this); + IsNewDbgInfoFormat = ParentModule->IsNewDbgInfoFormat; + } HasLLVMReservedName = getName().starts_with("llvm."); // Ensure intrinsics have the right parameter attributes. -- cgit v1.1