Skip to content

[NFC][Cloning] Make ClonedModule case more obvious in CollectDebugInfoForCloning #129143

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

Conversation

@llvmbot
Copy link
Member

llvmbot commented Feb 27, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Artem Pianykh (artempyanykh)

Changes

[NFC][Cloning] Make ClonedModule case more obvious in CollectDebugInfoForCloning

Summary:
The code's behavior is unchanged, but it's more obvious right now.

Test Plan:
ninja check-llvm-unit check-llvm


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/CloneFunction.cpp (+5-1)
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 58d400ac396be..9267930027c04 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -135,6 +135,10 @@ void llvm::CloneFunctionAttributesInto(Function *NewFunc,
 DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F,
                                                CloneFunctionChangeType Changes,
                                                DebugInfoFinder &DIFinder) {
+  // CloneModule takes care of cloning debug info.
+  if (Changes == CloneFunctionChangeType::ClonedModule)
+    return nullptr;
+
   DISubprogram *SPClonedWithinModule = nullptr;
   if (Changes < CloneFunctionChangeType::DifferentModule) {
     SPClonedWithinModule = F.getSubprogram();
@@ -143,7 +147,7 @@ DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F,
     DIFinder.processSubprogram(SPClonedWithinModule);
 
   const Module *M = F.getParent();
-  if (Changes != CloneFunctionChangeType::ClonedModule && M) {
+  if (M) {
     // Inspect instructions to process e.g. DILexicalBlocks of inlined functions
     for (const auto &I : instructions(F))
       DIFinder.processInstruction(*M, I);

@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream-part2-take2/1 branch from 6fc0fa0 to 25c4652 Compare February 27, 2025 23:35
jollaitbot pushed a commit to sailfishos-mirror/llvm-project that referenced this pull request Feb 28, 2025
…oForCloning

Summary:
The code's behavior is unchanged, but it's more obvious right now.

Test Plan:
ninja check-llvm-unit check-llvm

stack-info: PR: llvm/llvm-project#129143, branch: users/artempyanykh/fast-coro-upstream-part2-take2/1
…oForCloning

Summary:
The code's behavior is unchanged, but it's more obvious right now.

Test Plan:
ninja check-llvm-unit check-llvm

stack-info: PR: #129143, branch: users/artempyanykh/fast-coro-upstream-part2-take2/1
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream-part2-take2/1 branch from 25c4652 to 336c020 Compare March 9, 2025 14:30
@artempyanykh artempyanykh merged commit 7c4ef49 into main Mar 9, 2025
8 of 11 checks passed
@artempyanykh artempyanykh deleted the users/artempyanykh/fast-coro-upstream-part2-take2/1 branch March 9, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants