From ad6785fc3e6a2f782d0d892678be1cde5cedeb88 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 8 Mar 2025 01:05:23 -0800 Subject: [PATCH] [llvm-profgen] Avoid repeated hash lookups (NFC) --- llvm/tools/llvm-profgen/MissingFrameInferrer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp b/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp index ac88fced9159c..edfe8979c7121 100644 --- a/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp +++ b/llvm/tools/llvm-profgen/MissingFrameInferrer.cpp @@ -165,14 +165,14 @@ uint64_t MissingFrameInferrer::computeUniqueTailCallPath( if (CurSearchingDepth == MaximumSearchDepth) return 0; - - if (!FuncToTailCallMap.count(From)) + auto It = FuncToTailCallMap.find(From); + if (It == FuncToTailCallMap.end()) return 0; CurSearchingDepth++; Visiting.insert(From); uint64_t NumPaths = 0; - for (auto TailCall : FuncToTailCallMap[From]) { + for (auto TailCall : It->second) { NumPaths += computeUniqueTailCallPath(TailCall, To, Path); // Stop analyzing the remaining if we are already seeing more than one // reachable paths.