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

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


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

None

>From 34252da77cc3d3385a1b4c3c8f9558dff37bd8b0 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 18 Jan 2025 10:10:52 -0800
Subject: [PATCH] [Coroutines] Avoid repeated hash looksup (NFC)

---
 llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp b/llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp
index 6327cea64c0de62..cc462011a62423c 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