[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
This commit is contained in:
parent
a7d5b3f711
commit
df570dadcb
@ -160,32 +160,32 @@ MetadataSetTy
|
|||||||
llvm::FindDebugInfoToIdentityMap(CloneFunctionChangeType Changes,
|
llvm::FindDebugInfoToIdentityMap(CloneFunctionChangeType Changes,
|
||||||
DebugInfoFinder &DIFinder,
|
DebugInfoFinder &DIFinder,
|
||||||
DISubprogram *SPClonedWithinModule) {
|
DISubprogram *SPClonedWithinModule) {
|
||||||
|
if (Changes >= CloneFunctionChangeType::DifferentModule)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
if (DIFinder.subprogram_count() == 0)
|
||||||
|
assert(!SPClonedWithinModule &&
|
||||||
|
"Subprogram should be in DIFinder->subprogram_count()...");
|
||||||
|
|
||||||
MetadataSetTy MD;
|
MetadataSetTy MD;
|
||||||
|
|
||||||
if (Changes < CloneFunctionChangeType::DifferentModule &&
|
// Avoid cloning types, compile units, and (other) subprograms.
|
||||||
DIFinder.subprogram_count() > 0) {
|
for (DISubprogram *ISP : DIFinder.subprograms())
|
||||||
// Avoid cloning types, compile units, and (other) subprograms.
|
if (ISP != SPClonedWithinModule)
|
||||||
for (DISubprogram *ISP : DIFinder.subprograms()) {
|
MD.insert(ISP);
|
||||||
if (ISP != SPClonedWithinModule)
|
|
||||||
MD.insert(ISP);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a subprogram isn't going to be cloned skip its lexical blocks as well.
|
// If a subprogram isn't going to be cloned skip its lexical blocks as well.
|
||||||
for (DIScope *S : DIFinder.scopes()) {
|
for (DIScope *S : DIFinder.scopes()) {
|
||||||
auto *LScope = dyn_cast<DILocalScope>(S);
|
auto *LScope = dyn_cast<DILocalScope>(S);
|
||||||
if (LScope && LScope->getSubprogram() != SPClonedWithinModule)
|
if (LScope && LScope->getSubprogram() != SPClonedWithinModule)
|
||||||
MD.insert(S);
|
MD.insert(S);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DICompileUnit *CU : DIFinder.compile_units())
|
for (DICompileUnit *CU : DIFinder.compile_units())
|
||||||
MD.insert(CU);
|
MD.insert(CU);
|
||||||
|
|
||||||
for (DIType *Type : DIFinder.types())
|
for (DIType *Type : DIFinder.types())
|
||||||
MD.insert(Type);
|
MD.insert(Type);
|
||||||
} else {
|
|
||||||
assert(!SPClonedWithinModule &&
|
|
||||||
"Subprogram should be in DIFinder->subprogram_count()...");
|
|
||||||
}
|
|
||||||
|
|
||||||
return MD;
|
return MD;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user