[llvm] 1e81056 - [Coroutines] Avoid repeated hash lookups (NFC) (#111617)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 20:37:15 PDT 2024


Author: Kazu Hirata
Date: 2024-10-08T20:37:11-07:00
New Revision: 1e81056b31749f7b60d56260089f75a4813749c0

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

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

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 91530503a7e1ed..2b43b7a5d027d1 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -797,8 +797,8 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
     AlignInBits = OffsetCache[Index].first * 8;
     OffsetInBits = OffsetCache[Index].second * 8;
 
-    if (NameCache.contains(Index)) {
-      Name = NameCache[Index].str();
+    if (auto It = NameCache.find(Index); It != NameCache.end()) {
+      Name = It->second.str();
       DITy = TyCache[Index];
     } else {
       DITy = solveDIType(DBuilder, Ty, Layout, FrameDITy, LineNum, DITypeCache);


        


More information about the llvm-commits mailing list