Skip to content

Commit f6072c6

Browse files
committed
[Utils] Eliminate DISubprogram set from BuildDebugInfoMDMap
Summary: Previously, we'd add all SPs distinct from the cloned one into a set. Then when cloning a local scope we'd check if it's from one of those 'distinct' SPs by checking if it's in the set. We don't need to do that. We can just check against the cloned SP directly and drop the set. Test Plan: ninja check-llvm-unit
1 parent aa224af commit f6072c6

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/Transforms/Utils/CloneFunction.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,15 @@ bool llvm::BuildDebugInfoMDMap(MDMapT &MD, CloneFunctionChangeType Changes,
174174
};
175175

176176
// Avoid cloning types, compile units, and (other) subprograms.
177-
SmallPtrSet<const DISubprogram *, 16> MappedToSelfSPs;
178177
for (DISubprogram *ISP : DIFinder.subprograms()) {
179-
if (ISP != SPClonedWithinModule) {
178+
if (ISP != SPClonedWithinModule)
180179
mapToSelfIfNew(ISP);
181-
MappedToSelfSPs.insert(ISP);
182-
}
183180
}
184181

185182
// If a subprogram isn't going to be cloned skip its lexical blocks as well.
186183
for (DIScope *S : DIFinder.scopes()) {
187184
auto *LScope = dyn_cast<DILocalScope>(S);
188-
if (LScope && MappedToSelfSPs.count(LScope->getSubprogram()))
185+
if (LScope && LScope->getSubprogram() != SPClonedWithinModule)
189186
mapToSelfIfNew(S);
190187
}
191188

0 commit comments

Comments
 (0)