Skip to content

[Support] Avoid repeated hash lookups (NFC) #130891

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

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Mar 12, 2025

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) llvm/lib/Support/DebugCounter.cpp (+4-3)
diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp
index a5d8a704bdd21..3a5983c4788a1 100644
--- a/llvm/lib/Support/DebugCounter.cpp
+++ b/llvm/lib/Support/DebugCounter.cpp
@@ -208,9 +208,10 @@ void DebugCounter::print(raw_ostream &OS) const {
   OS << "Counters and values:\n";
   for (auto &CounterName : CounterNames) {
     unsigned CounterID = getCounterId(std::string(CounterName));
-    OS << left_justify(RegisteredCounters[CounterID], 32) << ": {"
-       << Us.Counters[CounterID].Count << ",";
-    printChunks(OS, Us.Counters[CounterID].Chunks);
+    auto &C = Us.Counters[CounterID];
+    OS << left_justify(RegisteredCounters[CounterID], 32) << ": {" << C.Count
+       << ",";
+    printChunks(OS, C.Chunks);
     OS << "}\n";
   }
 }

Co-authored-by: Nikita Popov <[email protected]>
@kazutakahirata kazutakahirata merged commit 4d79e98 into llvm:main Mar 12, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lookups_llvm_Support branch March 12, 2025 19:19
frederik-h pushed a commit to frederik-h/llvm-project that referenced this pull request Mar 18, 2025
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