[llvm] c531255 - [CodeGen] Avoid repeated hash lookups (NFC) (#123287)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 08:48:09 PST 2025


Author: Kazu Hirata
Date: 2025-01-17T08:48:06-08:00
New Revision: c5312553cb7a49b53ba2bac40fbc3c1745855844

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

LOG: [CodeGen] Avoid repeated hash lookups (NFC) (#123287)

Added: 
    

Modified: 
    llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index a465f52bfd5936..dbc724629d3bec 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -230,9 +230,10 @@ void FunctionVarLocs::init(FunctionVarLocsBuilder &Builder) {
     for (const DbgVariableRecord &DVR : filterDbgVars(I->getDbgRecordRange())) {
       // Even though DVR defines a variable location, VarLocsBeforeInst can
       // still be empty if that VarLoc was redundant.
-      if (!Builder.VarLocsBeforeInst.count(&DVR))
+      auto It = Builder.VarLocsBeforeInst.find(&DVR);
+      if (It == Builder.VarLocsBeforeInst.end())
         continue;
-      for (const VarLocInfo &VarLoc : Builder.VarLocsBeforeInst[&DVR])
+      for (const VarLocInfo &VarLoc : It->second)
         VarLocRecords.emplace_back(VarLoc);
     }
     for (const VarLocInfo &VarLoc : P.second)


        


More information about the llvm-commits mailing list