aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/CloneFunction.cpp
diff options
context:
space:
mode:
authorArtem Pianykh <artem.pyanykh@gmail.com>2025-03-09 17:49:24 +0000
committerGitHub <noreply@github.com>2025-03-09 17:49:24 +0000
commitdf570dadcb93a32c308d31c2ab54d2f46c8ae0c0 (patch)
tree19ba4529598b248c32d55435683e4559de1ea351 /llvm/lib/Transforms/Utils/CloneFunction.cpp
parenta7d5b3f711b7c852aa1337e329661dd36025865a (diff)
downloadllvm-df570dadcb93a32c308d31c2ab54d2f46c8ae0c0.zip
llvm-df570dadcb93a32c308d31c2ab54d2f46c8ae0c0.tar.gz
llvm-df570dadcb93a32c308d31c2ab54d2f46c8ae0c0.tar.bz2
[NFC][Cloning] Simplify the flow in FindDebugInfoToIdentityMap (#129144)
Summary: The new flow should make it more clear what is happening in cases of Different of Cloned modules. Test Plan: ninja check-llvm-unit check-llvm
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/CloneFunction.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 9267930..7a309f7 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -160,32 +160,32 @@ MetadataSetTy
llvm::FindDebugInfoToIdentityMap(CloneFunctionChangeType Changes,
DebugInfoFinder &DIFinder,
DISubprogram *SPClonedWithinModule) {
+ if (Changes >= CloneFunctionChangeType::DifferentModule)
+ return {};
+
+ if (DIFinder.subprogram_count() == 0)
+ assert(!SPClonedWithinModule &&
+ "Subprogram should be in DIFinder->subprogram_count()...");
+
MetadataSetTy MD;
- if (Changes < CloneFunctionChangeType::DifferentModule &&
- DIFinder.subprogram_count() > 0) {
- // Avoid cloning types, compile units, and (other) subprograms.
- for (DISubprogram *ISP : DIFinder.subprograms()) {
- if (ISP != SPClonedWithinModule)
- MD.insert(ISP);
- }
+ // Avoid cloning types, compile units, and (other) subprograms.
+ for (DISubprogram *ISP : DIFinder.subprograms())
+ if (ISP != SPClonedWithinModule)
+ MD.insert(ISP);
- // 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);
- if (LScope && LScope->getSubprogram() != SPClonedWithinModule)
- MD.insert(S);
- }
+ // 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);
+ if (LScope && LScope->getSubprogram() != SPClonedWithinModule)
+ MD.insert(S);
+ }
for (DICompileUnit *CU : DIFinder.compile_units())
MD.insert(CU);
for (DIType *Type : DIFinder.types())
MD.insert(Type);
- } else {
- assert(!SPClonedWithinModule &&
- "Subprogram should be in DIFinder->subprogram_count()...");
- }
return MD;
}