[llvm] df25511 - [Coroutines] Avoid repeated hash lookups (NFC) (#126432)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 9 13:35:15 PST 2025


Author: Kazu Hirata
Date: 2025-02-09T13:35:12-08:00
New Revision: df25511f0e13e8292de485c2c4d7b58941c77afb

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

LOG: [Coroutines] Avoid repeated hash lookups (NFC) (#126432)

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index c56d1bf33efd877..4104e4e533e9d86 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -752,13 +752,14 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
                                   dwarf::DW_ATE_unsigned_char)});
 
   for (auto *V : FrameData.getAllDefs()) {
-    if (!DIVarCache.contains(V))
+    auto It = DIVarCache.find(V);
+    if (It == DIVarCache.end())
       continue;
 
     auto Index = FrameData.getFieldIndex(V);
 
-    NameCache.insert({Index, DIVarCache[V]->getName()});
-    TyCache.insert({Index, DIVarCache[V]->getType()});
+    NameCache.insert({Index, It->second->getName()});
+    TyCache.insert({Index, It->second->getType()});
   }
 
   // Cache from index to (Align, Offset Pair)


        


More information about the llvm-commits mailing list