Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC][Utils] Eliminate DISubprogram set from BuildDebugInfoMDMap #118625

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

artempyanykh
Copy link
Contributor

@artempyanykh artempyanykh commented Dec 4, 2024

Stacked PRs:


[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

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

stack-info: PR: #118625, branch: users/artempyanykh/fast-coro-upstream/6
@llvmbot
Copy link
Member

llvmbot commented Dec 4, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Artem Pianykh (artempyanykh)

Changes

[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 --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);
     }
 

@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/5 branch from 4bda093 to 44ae17c Compare December 4, 2024 13:16
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from e74ea37 to 302580a Compare December 4, 2024 13:16
jollaitbot pushed a commit to sailfishos-mirror/llvm-project that referenced this pull request Dec 4, 2024
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

stack-info: PR: llvm/llvm-project#118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/5 branch from 44ae17c to 39cccf5 Compare December 6, 2024 12:42
artempyanykh added a commit that referenced this pull request Dec 6, 2024
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

stack-info: PR: #118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from 302580a to 1b7941e Compare December 6, 2024 12:43
@artempyanykh artempyanykh changed the base branch from users/artempyanykh/fast-coro-upstream/5 to main December 6, 2024 14:03
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from 1b7941e to 51e786e Compare December 6, 2024 14:04
@artempyanykh artempyanykh changed the base branch from main to users/artempyanykh/fast-coro-upstream/5 December 6, 2024 14:04
jollaitbot pushed a commit to sailfishos-mirror/llvm-project that referenced this pull request Dec 6, 2024
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

stack-info: PR: llvm/llvm-project#118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/5 branch from 4d03e3f to d5ed405 Compare December 9, 2024 12:40
artempyanykh added a commit that referenced this pull request Dec 9, 2024
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

stack-info: PR: #118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from 51e786e to 160c6fe Compare December 9, 2024 12:40
@artempyanykh artempyanykh changed the base branch from users/artempyanykh/fast-coro-upstream/5 to main December 9, 2024 16:57
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from 160c6fe to a6885e9 Compare December 9, 2024 16:57
@artempyanykh artempyanykh changed the base branch from main to users/artempyanykh/fast-coro-upstream/5 December 9, 2024 16:57
artempyanykh added a commit to artempyanykh/llvm-project that referenced this pull request Dec 9, 2024
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

stack-info: PR: llvm#118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/5 branch from 6845960 to 77bb594 Compare December 10, 2024 08:10
artempyanykh added a commit that referenced this pull request Dec 10, 2024
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

stack-info: PR: #118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from a6885e9 to c351d4a Compare December 10, 2024 08:10
@artempyanykh artempyanykh changed the base branch from users/artempyanykh/fast-coro-upstream/5 to main December 11, 2024 07:48
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from c351d4a to b5d377b Compare December 11, 2024 07:48
@artempyanykh artempyanykh changed the base branch from main to users/artempyanykh/fast-coro-upstream/5 December 11, 2024 07:48
@artempyanykh artempyanykh changed the base branch from users/artempyanykh/fast-coro-upstream/5 to main December 11, 2024 09:32
@artempyanykh artempyanykh changed the base branch from main to users/artempyanykh/fast-coro-upstream/5 December 11, 2024 09:32
jollaitbot pushed a commit to sailfishos-mirror/llvm-project that referenced this pull request Dec 11, 2024
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

stack-info: PR: llvm/llvm-project#118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/5 branch from 1560bb0 to b679aaa Compare December 16, 2024 20:50
artempyanykh added a commit that referenced this pull request Dec 16, 2024
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

stack-info: PR: #118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from b5d377b to eba5202 Compare December 16, 2024 20:50
Base automatically changed from users/artempyanykh/fast-coro-upstream/5 to main December 16, 2024 22:30
@artempyanykh artempyanykh force-pushed the users/artempyanykh/fast-coro-upstream/6 branch from eba5202 to 77e2b63 Compare December 16, 2024 22:31
artempyanykh added a commit that referenced this pull request Dec 16, 2024
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

stack-info: PR: #118625, branch: users/artempyanykh/fast-coro-upstream/6
@artempyanykh artempyanykh merged commit fbdbb13 into main Dec 17, 2024
8 checks passed
@artempyanykh artempyanykh deleted the users/artempyanykh/fast-coro-upstream/6 branch December 17, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants