[llvm] [Support] Avoid repeated hash lookups (NFC) (PR #127747)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 21:09:51 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/127747
None
>From 17e907ea2edf365ee1e596a9a101dc694762258c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 18 Feb 2025 08:43:30 -0800
Subject: [PATCH] [Support] Avoid repeated hash lookups (NFC)
---
llvm/include/llvm/Support/DebugCounter.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5739e99..8e9dc29e4f48a 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -162,8 +162,9 @@ class DebugCounter {
protected:
unsigned addCounter(const std::string &Name, const std::string &Desc) {
unsigned Result = RegisteredCounters.insert(Name);
- Counters[Result] = {};
- Counters[Result].Desc = Desc;
+ auto &C = Counters[Result];
+ C = {};
+ C.Desc = Desc;
return Result;
}
// Struct to store counter info.
More information about the llvm-commits
mailing list