[Mlir-commits] [mlir] 42494e5 - [Transforms] Avoid repeated hash lookups (NFC) (#108322)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Sep 12 00:52:41 PDT 2024
Author: Kazu Hirata
Date: 2024-09-12T00:52:38-07:00
New Revision: 42494e51753823f6e2bd8f9abf665006a9bdc445
URL: https://github.com/llvm/llvm-project/commit/42494e51753823f6e2bd8f9abf665006a9bdc445
DIFF: https://github.com/llvm/llvm-project/commit/42494e51753823f6e2bd8f9abf665006a9bdc445.diff
LOG: [Transforms] Avoid repeated hash lookups (NFC) (#108322)
Added:
Modified:
mlir/lib/Transforms/Mem2Reg.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/Mem2Reg.cpp b/mlir/lib/Transforms/Mem2Reg.cpp
index 4bc2bbd12b0945..144f9f01142a09 100644
--- a/mlir/lib/Transforms/Mem2Reg.cpp
+++ b/mlir/lib/Transforms/Mem2Reg.cpp
@@ -343,9 +343,8 @@ SmallPtrSet<Block *, 16> MemorySlotPromotionAnalyzer::computeSlotLiveIn(
// blocks.
SmallPtrSet<Block *, 16> visited;
for (Operation *user : slot.ptr.getUsers()) {
- if (visited.contains(user->getBlock()))
+ if (!visited.insert(user->getBlock()).second)
continue;
- visited.insert(user->getBlock());
for (Operation &op : user->getBlock()->getOperations()) {
if (auto memOp = dyn_cast<PromotableMemOpInterface>(op)) {
More information about the Mlir-commits
mailing list