Skip to content

Module::getOrInsertFunction: set debug info format #82505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

hvdijk
Copy link
Contributor

@hvdijk hvdijk commented Feb 21, 2024

Function::Function's constructor sets the debug info format based on the passed in parent Module, so by using this rather than modifying the function list directly, we pick up the debug info format automatically.

Function::Function's constructor sets the debug info format based on the
passed in parent Module, so by using this rather than modifying the
function list directly, we pick up the debug info format automatically.
@llvmbot
Copy link
Member

llvmbot commented Feb 21, 2024

@llvm/pr-subscribers-llvm-ir

Author: Harald van Dijk (hvdijk)

Changes

Function::Function's constructor sets the debug info format based on the passed in parent Module, so by using this rather than modifying the function list directly, we pick up the debug info format automatically.


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

1 Files Affected:

  • (modified) llvm/lib/IR/Module.cpp (+1-2)
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index eeb90a6cb3c465..1946db2ee0be7e 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -149,10 +149,9 @@ FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty,
   if (!F) {
     // Nope, add it
     Function *New = Function::Create(Ty, GlobalVariable::ExternalLinkage,
-                                     DL.getProgramAddressSpace(), Name);
+                                     DL.getProgramAddressSpace(), Name, this);
     if (!New->isIntrinsic())       // Intrinsics get attrs set on construction
       New->setAttributes(AttributeList);
-    FunctionList.push_back(New);
     return {Ty, New}; // Return the new prototype.
   }
 

Copy link
Member

@jmorse jmorse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the catch!

@hvdijk hvdijk merged commit 162fa4d into llvm:main Feb 21, 2024
@hvdijk hvdijk deleted the getorinsertfunction-debug-info-format branch February 21, 2024 16:40
qiaojbao pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Mar 21, 2024
…2a1875722

Local branch amd-gfx 7ab2a18 Merged main:73185854a3fc469b7d3e21d0b5d2ecb5ee15d201 into amd-gfx:e849a3027d34
Remote branch main 162fa4d Module::getOrInsertFunction: set debug info format (llvm#82505)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants