[llvm] [Coroutines] Avoid repeated hash looksup (NFC) (PR #123501)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 18 22:20:59 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-coroutines

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/123501.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp (+2-2) 


``````````diff
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;
       }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/123501


More information about the llvm-commits mailing list