Skip to content

[DebugInfo] Avoid repeated hash lookups (NFC) #110620

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

Merged

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 1, 2024

@llvm/pr-subscribers-debuginfo

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/110620.diff

1 Files Affected:

  • (modified) llvm/lib/DebugInfo/LogicalView/Core/LVCompare.cpp (+3-2)
diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVCompare.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVCompare.cpp
index 3ed0de14f93f07..5673ea7c2cd230 100644
--- a/llvm/lib/DebugInfo/LogicalView/Core/LVCompare.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Core/LVCompare.cpp
@@ -312,8 +312,9 @@ Error LVCompare::execute(LVReader *ReferenceReader, LVReader *TargetReader) {
 
       // We need to find an insertion point in the reference scopes tree.
       Parent = Element->getParentScope();
-      if (ScopeLinks.find(Parent) != ScopeLinks.end()) {
-        LVScope *InsertionPoint = ScopeLinks[Parent];
+      auto It = ScopeLinks.find(Parent);
+      if (It != ScopeLinks.end()) {
+        LVScope *InsertionPoint = It->second;
         LLVM_DEBUG({
           dbgs() << "Inserted at: "
                  << hexSquareString(InsertionPoint->getOffset()) << "\n";

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata merged commit f01d45c into llvm:main Oct 1, 2024
10 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_DebugInfo branch October 1, 2024 14:48
Sterling-Augustine pushed a commit to Sterling-Augustine/llvm-project that referenced this pull request Oct 3, 2024
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