aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-02-19 08:21:33 -0800
committerGitHub <noreply@github.com>2025-02-19 08:21:33 -0800
commitbb75a96900ad52b01e51fc42c3533a6febf97e27 (patch)
tree9c0301a2f2173e8fa5ec17e482736373b78aae6f
parent1bb72f0d7dd623e1c75dbe9e6a7f6b41f5284474 (diff)
downloadllvm-bb75a96900ad52b01e51fc42c3533a6febf97e27.zip
llvm-bb75a96900ad52b01e51fc42c3533a6febf97e27.tar.gz
llvm-bb75a96900ad52b01e51fc42c3533a6febf97e27.tar.bz2
[Support] Avoid repeated hash lookups (NFC) (#127747)
-rw-r--r--llvm/include/llvm/Support/DebugCounter.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5..8e9dc29 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -162,8 +162,9 @@ public:
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.