[Mlir-commits] [mlir] [Transforms] Avoid repeated hash lookups (NFC) (PR #111329)

Kazu Hirata llvmlistbot at llvm.org
Sun Oct 6 19:33:40 PDT 2024


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

None

>From 7c994a5790a93d33bf79716f7ee8421cec0d1fa6 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 6 Oct 2024 09:28:58 -0700
Subject: [PATCH] [Transforms] Avoid repeated hash lookups (NFC)

---
 mlir/lib/Transforms/Mem2Reg.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Transforms/Mem2Reg.cpp b/mlir/lib/Transforms/Mem2Reg.cpp
index 144f9f01142a09..d339073771fb5c 100644
--- a/mlir/lib/Transforms/Mem2Reg.cpp
+++ b/mlir/lib/Transforms/Mem2Reg.cpp
@@ -285,10 +285,11 @@ LogicalResult MemorySlotPromotionAnalyzer::computeBlockingUses(
   mlir::getForwardSlice(slot.ptr, &forwardSlice);
   for (Operation *user : forwardSlice) {
     // If the next operation has no blocking uses, everything is fine.
-    if (!userToBlockingUses.contains(user))
+    auto it = userToBlockingUses.find(user);
+    if (it == userToBlockingUses.end())
       continue;
 
-    SmallPtrSet<OpOperand *, 4> &blockingUses = userToBlockingUses[user];
+    SmallPtrSet<OpOperand *, 4> &blockingUses = it->second;
 
     SmallVector<OpOperand *> newBlockingUses;
     // If the operation decides it cannot deal with removing the blocking uses,



More information about the Mlir-commits mailing list