[llvm-branch-commits] [llvm] [NFC][Utils] Eliminate DISubprogram set from BuildDebugInfoMDMap (PR #118625)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Dec 4 05:16:24 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Artem Pianykh (artempyanykh)
<details>
<summary>Changes</summary>
[NFC][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 check-llvm
---
Full diff: https://github.com/llvm/llvm-project/pull/118625.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Utils/CloneFunction.cpp (+2-5)
``````````diff
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 1f4cdec333a2c2..5bc90bc7ae23da 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -171,18 +171,15 @@ bool llvm::BuildDebugInfoMDMap(MDMapT &MD, CloneFunctionChangeType Changes,
};
// Avoid cloning types, compile units, and (other) subprograms.
- SmallPtrSet<const DISubprogram *, 16> MappedToSelfSPs;
for (DISubprogram *ISP : DIFinder.subprograms()) {
- if (ISP != SPClonedWithinModule) {
+ if (ISP != SPClonedWithinModule)
mapToSelfIfNew(ISP);
- MappedToSelfSPs.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 && MappedToSelfSPs.count(LScope->getSubprogram()))
+ if (LScope && LScope->getSubprogram() != SPClonedWithinModule)
mapToSelfIfNew(S);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/118625
More information about the llvm-branch-commits
mailing list