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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Oct 13 21:05:13 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) mlir/lib/Transforms/SROA.cpp (+3-2) 


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

``````````

</details>


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


More information about the Mlir-commits mailing list