-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[NFC][Cloning] Make DifferentModule case more obvious in CollectDebugInfoForCloning #129146
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
[NFC][Cloning] Make DifferentModule case more obvious in CollectDebugInfoForCloning #129146
Conversation
…InfoForCloning Summary: This should be behaviorally equivalent. DIFinder is only used when cloning into a DifferentModule as part of llvm.dbg.cu update in CloneFunctionInto. Test Plan: ninja check-llvm-unit check-llvm stack-info: PR: #129146, branch: users/artempyanykh/fast-coro-upstream-part2-take2/4
@llvm/pr-subscribers-llvm-transforms Author: Artem Pianykh (artempyanykh) Changes[NFC][Cloning] Make DifferentModule case more obvious in CollectDebugInfoForCloning Summary: Test Plan: Full diff: https://github.com/llvm/llvm-project/pull/129146.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 9ea4e64671c7e..6b6315d698c9a 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -147,8 +147,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)
+ // CloneModule takes care of cloning debug info for ClonedModule. Cloning into
+ // DifferentModule is taken care of separately in ClonedFunctionInto as part
+ // of llvm.dbg.cu update.
+ if (Changes >= CloneFunctionChangeType::DifferentModule)
return nullptr;
DISubprogram *SPClonedWithinModule = nullptr;
@@ -362,6 +364,10 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
SmallPtrSet<const void *, 8> Visited;
for (auto *Operand : NMD->operands())
Visited.insert(Operand);
+
+ // Collect and clone all the compile units referenced from the instructions in
+ // the function (e.g. as a scope).
+ collectDebugInfoFromInstructions(*OldFunc, DIFinder);
for (auto *Unit : DIFinder.compile_units()) {
MDNode *MappedUnit =
MapMetadata(Unit, VMap, RF_None, TypeMapper, Materializer);
|
36b445a
to
dd91189
Compare
90deeb1
to
d02c645
Compare
…InfoForCloning Summary: This should be behaviorally equivalent. DIFinder is only used when cloning into a DifferentModule as part of llvm.dbg.cu update in CloneFunctionInto. Test Plan: ninja check-llvm-unit check-llvm stack-info: PR: llvm/llvm-project#129146, branch: users/artempyanykh/fast-coro-upstream-part2-take2/4
// CloneModule takes care of cloning debug info for ClonedModule. Cloning into | ||
// DifferentModule is taken care of separately in ClonedFunctionInto as part | ||
// of llvm.dbg.cu update. | ||
if (Changes >= CloneFunctionChangeType::DifferentModule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI the check in CloneFunctionInto is:
if (Changes != CloneFunctionChangeType::DifferentModule)
return;
Should we make it <
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felipepiovezan sorry I didn't get that. Could you elaborate please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that FindDebugInfoToIdentityMap and CollectDebugInfoForCloning get removed later in the stack, I'm going to go ahead and merge this. Please, let me know if I missed something important and I'll fix it on top.
d02c645
to
6e8df0d
Compare
33b79c9
to
181b126
Compare
…InfoForCloning Summary: This should be behaviorally equivalent. DIFinder is only used when cloning into a DifferentModule as part of llvm.dbg.cu update in CloneFunctionInto. Test Plan: ninja check-llvm-unit check-llvm stack-info: PR: #129146, branch: users/artempyanykh/fast-coro-upstream-part2-take2/4
6e8df0d
to
7344ea1
Compare
181b126
to
e370743
Compare
…InfoForCloning Summary: This should be behaviorally equivalent. DIFinder is only used when cloning into a DifferentModule as part of llvm.dbg.cu update in CloneFunctionInto. Test Plan: ninja check-llvm-unit check-llvm stack-info: PR: #129146, branch: users/artempyanykh/fast-coro-upstream-part2-take2/4
7344ea1
to
52f4ec3
Compare
52f4ec3
to
46dfb15
Compare
Stacked PRs:
[NFC][Cloning] Make DifferentModule case more obvious in CollectDebugInfoForCloning
Summary:
This should be behaviorally equivalent. DIFinder is only used when
cloning into a DifferentModule as part of llvm.dbg.cu update in
CloneFunctionInto.
Test Plan:
ninja check-llvm-unit check-llvm