Skip to content

[NFC][Cloning] Add a helper to collect debug info from instructions #129145

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

Summary:
Just moving around. This helper will be used for further refactoring.

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

stack-info: PR: #129145, branch: users/artempyanykh/fast-coro-upstream-part2-take2/3
@llvmbot
Copy link
Member

llvmbot commented Feb 27, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Artem Pianykh (artempyanykh)

Changes

[NFC][Cloning] Add a helper to collect debug info from instructions

Summary:
Just moving around. This helper will be used for further refactoring.

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


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/CloneFunction.cpp (+13-6)
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 5a5b84c8e0a3c..9ea4e64671c7e 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -40,6 +40,18 @@ using namespace llvm;
 
 #define DEBUG_TYPE "clone-function"
 
+namespace {
+void collectDebugInfoFromInstructions(const Function &F,
+                                      DebugInfoFinder &DIFinder) {
+  const Module *M = F.getParent();
+  if (M) {
+    // Inspect instructions to process e.g. DILexicalBlocks of inlined functions
+    for (const auto &I : instructions(F))
+      DIFinder.processInstruction(*M, I);
+  }
+}
+} // namespace
+
 /// See comments in Cloning.h.
 BasicBlock *llvm::CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap,
                                   const Twine &NameSuffix, Function *F,
@@ -146,12 +158,7 @@ DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F,
   if (SPClonedWithinModule)
     DIFinder.processSubprogram(SPClonedWithinModule);
 
-  const Module *M = F.getParent();
-  if (M) {
-    // Inspect instructions to process e.g. DILexicalBlocks of inlined functions
-    for (const auto &I : instructions(F))
-      DIFinder.processInstruction(*M, I);
-  }
+  collectDebugInfoFromInstructions(F, DIFinder);
 
   return SPClonedWithinModule;
 }

@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream-part2-take2/2 branch from 7cc5e27 to eefce02 Compare February 27, 2025 23:35
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream-part2-take2/3 branch from 36b445a to dd91189 Compare February 27, 2025 23:35
jollaitbot pushed a commit to sailfishos-mirror/llvm-project that referenced this pull request Feb 28, 2025
Summary:
Just moving around. This helper will be used for further refactoring.

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

stack-info: PR: llvm/llvm-project#129145, branch: users/artempyanykh/fast-coro-upstream-part2-take2/3
@artempyanykh artempyanykh changed the base branch from users/artempyanykh/fast-coro-upstream-part2-take2/2 to main March 9, 2025 14:29
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream-part2-take2/3 branch from dd91189 to 33b79c9 Compare March 9, 2025 14:30
@artempyanykh artempyanykh changed the base branch from main to users/artempyanykh/fast-coro-upstream-part2-take2/2 March 9, 2025 14:30
@artempyanykh artempyanykh changed the base branch from users/artempyanykh/fast-coro-upstream-part2-take2/2 to main March 9, 2025 14:32
@artempyanykh artempyanykh changed the base branch from main to users/artempyanykh/fast-coro-upstream-part2-take2/2 March 9, 2025 14:32
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream-part2-take2/2 branch from 7888809 to 36480c7 Compare March 9, 2025 15:49
artempyanykh added a commit that referenced this pull request Mar 9, 2025
Summary:
Just moving around. This helper will be used for further refactoring.

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

stack-info: PR: #129145, branch: users/artempyanykh/fast-coro-upstream-part2-take2/3
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream-part2-take2/3 branch from 33b79c9 to 181b126 Compare March 9, 2025 15:49
Base automatically changed from users/artempyanykh/fast-coro-upstream-part2-take2/2 to main March 9, 2025 17:49
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream-part2-take2/3 branch from 181b126 to e370743 Compare March 9, 2025 17:49
@artempyanykh artempyanykh merged commit 29129be into main Mar 9, 2025
11 checks passed
@artempyanykh artempyanykh deleted the users/artempyanykh/fast-coro-upstream-part2-take2/3 branch March 9, 2025 18:35
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