[llvm] 6a5a795 - [Coroutines] Avoid repeated hash looksup (NFC) (#123501)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 19 10:58:04 PST 2025


Author: Kazu Hirata
Date: 2025-01-19T10:57:59-08:00
New Revision: 6a5a795c2b3623786129a2551627fcd5b44f9f9a

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

LOG: [Coroutines] Avoid repeated hash looksup (NFC) (#123501)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp b/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp
index 6327cea64c0de6..cc462011a62423 100644
--- a/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp
+++ b/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp
@@ -81,9 +81,9 @@ struct RematGraph {
           !Checker.isDefinitionAcrossSuspend(*D, FirstUse))
         continue;
 
-      if (Remats.count(D)) {
+      if (auto It = Remats.find(D); It != Remats.end()) {
         // Already have this in the graph
-        N->Operands.push_back(Remats[D].get());
+        N->Operands.push_back(It->second.get());
         continue;
       }
 


        


More information about the llvm-commits mailing list