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

Kazu Hirata llvmlistbot at llvm.org
Sun Oct 13 21:04:37 PDT 2024


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

None

>From de6f7fcc47f037d21fecb5cdf95a9653cabe405e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 13 Oct 2024 07:50:47 -0700
Subject: [PATCH] [mlir] Avoid repeated hash lookups (NFC)

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

diff --git a/mlir/lib/Transforms/SROA.cpp b/mlir/lib/Transforms/SROA.cpp
index aca252b01dce7b..db8be38a51443e 100644
--- a/mlir/lib/Transforms/SROA.cpp
+++ b/mlir/lib/Transforms/SROA.cpp
@@ -100,10 +100,11 @@ computeDestructuringInfo(DestructurableMemorySlot &slot,
   mlir::getForwardSlice(slot.ptr, &forwardSlice);
   for (Operation *user : forwardSlice) {
     // If the next operation has no blocking uses, everything is fine.
-    if (!info.userToBlockingUses.contains(user))
+    auto it = info.userToBlockingUses.find(user);
+    if (it == info.userToBlockingUses.end())
       continue;
 
-    SmallPtrSet<OpOperand *, 4> &blockingUses = info.userToBlockingUses[user];
+    SmallPtrSet<OpOperand *, 4> &blockingUses = it->second;
     auto promotable = dyn_cast<PromotableOpInterface>(user);
 
     // An operation that has blocking uses must be promoted. If it is not



More information about the Mlir-commits mailing list