[llvm] [ProfileData] Avoid repeated hash lookups (NFC) (PR #125464)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 2 23:05:54 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/125464

None

>From a9980097e99e1dc5d1b82b22e7afb8513175ef1a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 2 Feb 2025 22:52:52 -0800
Subject: [PATCH] [ProfileData] Avoid repeated hash lookups (NFC)

---
 llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
index 5a20a9ef63287e..4fc0133443192d 100644
--- a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
+++ b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
@@ -541,9 +541,9 @@ struct MCDCRecord {
 
   std::string getConditionHeaderString(unsigned Condition) {
     std::ostringstream OS;
-    OS << "Condition C" << Condition + 1 << " --> (";
-    OS << CondLoc[Condition].first << ":" << CondLoc[Condition].second;
-    OS << ")\n";
+    const auto &[Line, Col] = CondLoc[Condition];
+    OS << "Condition C" << Condition + 1 << " --> (" << Line << ":" << Col
+       << ")\n";
     return OS.str();
   }
 



More information about the llvm-commits mailing list