aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorDavide Italiano <davidino@fb.com>2024-01-16 16:56:24 -0800
committerDavide Italiano <davidino@fb.com>2024-01-16 17:01:01 -0800
commitb6f922fbf5e983122271aa12acb33f6172046d4d (patch)
treea09e77e1349eabc624db86005386de27eb1d5a9a /llvm/lib/Transforms/Utils/CloneFunction.cpp
parentc3f96acb41ef20a1f84715b1b6fb39e916f9aac8 (diff)
downloadllvm-b6f922fbf5e983122271aa12acb33f6172046d4d.zip
llvm-b6f922fbf5e983122271aa12acb33f6172046d4d.tar.gz
llvm-b6f922fbf5e983122271aa12acb33f6172046d4d.tar.bz2
Revert "[CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (#75385)"
This reverts commit fc6faa1113e9069f41b5500db051210af0eea843.
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 2547ac0..c0f3333 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -232,20 +232,12 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
// Avoid cloning types, compile units, and (other) subprograms.
SmallPtrSet<const DISubprogram *, 16> MappedToSelfSPs;
for (DISubprogram *ISP : DIFinder->subprograms()) {
- // Don't clone inlined subprograms.
if (ISP != SPClonedWithinModule) {
mapToSelfIfNew(ISP);
MappedToSelfSPs.insert(ISP);
}
}
- // Avoid cloning local variables of subprograms that won't be cloned.
- for (DILocalVariable *DV : DIFinder->local_variables())
- if (auto *S = dyn_cast_or_null<DILocalScope>(DV->getScope()))
- if (DISubprogram *SP = S->getSubprogram())
- if (MappedToSelfSPs.contains(SP))
- mapToSelfIfNew(DV);
-
// If a subprogram isn't going to be cloned skip its lexical blocks as well.
for (DIScope *S : DIFinder->scopes()) {
auto *LScope = dyn_cast<DILocalScope>(S);
@@ -257,12 +249,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
mapToSelfIfNew(CU);
for (DIType *Type : DIFinder->types())
- // Don't skip subprogram's local types.
- if (!isa_and_present<DILocalScope>(Type->getScope()) ||
- SPClonedWithinModule == nullptr ||
- dyn_cast<DILocalScope>(Type->getScope())->getSubprogram() !=
- SPClonedWithinModule)
- mapToSelfIfNew(Type);
+ mapToSelfIfNew(Type);
} else {
assert(!SPClonedWithinModule &&
"Subprogram should be in DIFinder->subprogram_count()...");