From d94b62a4a55933c2b47aea1e24927b29c46cdb01 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 8 Feb 2025 14:37:43 -0800 Subject: [PATCH] [Passes] Avoid repeated hash lookups (NFC) --- llvm/include/llvm/Passes/DroppedVariableStats.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/Passes/DroppedVariableStats.h b/llvm/include/llvm/Passes/DroppedVariableStats.h index e2e91891e24c1..30fbeae703b03 100644 --- a/llvm/include/llvm/Passes/DroppedVariableStats.h +++ b/llvm/include/llvm/Passes/DroppedVariableStats.h @@ -96,9 +96,10 @@ class DroppedVariableStats { DenseSet &DebugVariablesBeforeSet = DbgVariables.DebugVariablesBefore; DenseSet &DebugVariablesAfterSet = DbgVariables.DebugVariablesAfter; - if (InlinedAts.back().find(FuncName) == InlinedAts.back().end()) + auto It = InlinedAts.back().find(FuncName); + if (It == InlinedAts.back().end()) return; - DenseMap &InlinedAtsMap = InlinedAts.back()[FuncName]; + DenseMap &InlinedAtsMap = It->second; // Find an Instruction that shares the same scope as the dropped #dbg_value // or has a scope that is the child of the scope of the #dbg_value, and has // an inlinedAt equal to the inlinedAt of the #dbg_value or it's inlinedAt