[llvm] [ProfileData] Use DenseMap::lookup (NFC) (PR #94818)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 16:51:38 PDT 2024


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

None

>From eb12810d3c6def493e6106333056b3892bb5901c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 7 Jun 2024 16:49:00 -0700
Subject: [PATCH] [ProfileData] Use DenseMap::lookup (NFC)

---
 llvm/include/llvm/ProfileData/InstrProf.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index 15b9eb688e27e..8db10127421aa 100644
--- a/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/llvm/include/llvm/ProfileData/InstrProf.h
@@ -729,9 +729,7 @@ Function* InstrProfSymtab::getFunction(uint64_t FuncMD5Hash) {
 }
 
 GlobalVariable *InstrProfSymtab::getGlobalVariable(uint64_t MD5Hash) {
-  if (auto Iter = MD5VTableMap.find(MD5Hash); Iter != MD5VTableMap.end())
-    return Iter->second;
-  return nullptr;
+  return MD5VTableMap.lookup(MD5Hash);
 }
 
 // To store the sums of profile count values, or the percentage of



More information about the llvm-commits mailing list