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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 7 07:01:10 PDT 2024


Author: Kazu Hirata
Date: 2024-10-07T07:01:07-07:00
New Revision: 5fdda4147495c6bcfb6c100dbf32a669c3b39874

URL: https://github.com/llvm/llvm-project/commit/5fdda4147495c6bcfb6c100dbf32a669c3b39874
DIFF: https://github.com/llvm/llvm-project/commit/5fdda4147495c6bcfb6c100dbf32a669c3b39874.diff

LOG: [Transforms] Avoid repeated hash lookups (NFC) (#111329)

Added: 
    

Modified: 
    mlir/lib/Transforms/Mem2Reg.cpp

Removed: 
    


################################################################################
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