[llvm] 25ebdfc - [IR] Avoid repeated hash lookups (NFC) (#128998)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 01:46:02 PST 2025


Author: Kazu Hirata
Date: 2025-02-27T01:45:59-08:00
New Revision: 25ebdfc3dd26b023b8591118492be1fea2574f03

URL: https://github.com/llvm/llvm-project/commit/25ebdfc3dd26b023b8591118492be1fea2574f03
DIFF: https://github.com/llvm/llvm-project/commit/25ebdfc3dd26b023b8591118492be1fea2574f03.diff

LOG: [IR] Avoid repeated hash lookups (NFC) (#128998)

Added: 
    

Modified: 
    llvm/lib/IR/DroppedVariableStats.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/DroppedVariableStats.cpp b/llvm/lib/IR/DroppedVariableStats.cpp
index d80ac9339a1b2..9e221bf585f1a 100644
--- a/llvm/lib/IR/DroppedVariableStats.cpp
+++ b/llvm/lib/IR/DroppedVariableStats.cpp
@@ -44,9 +44,10 @@ void DroppedVariableStats::calculateDroppedStatsAndPrint(
   unsigned DroppedCount = 0;
   DenseSet<VarID> &DebugVariablesBeforeSet = DbgVariables.DebugVariablesBefore;
   DenseSet<VarID> &DebugVariablesAfterSet = DbgVariables.DebugVariablesAfter;
-  if (InlinedAts.back().find(FuncName) == InlinedAts.back().end())
+  auto It = InlinedAts.back().find(FuncName);
+  if (It == InlinedAts.back().end())
     return;
-  DenseMap<VarID, DILocation *> &InlinedAtsMap = InlinedAts.back()[FuncName];
+  DenseMap<VarID, DILocation *> &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


        


More information about the llvm-commits mailing list