[Mlir-commits] [mlir] [Transforms] Avoid repeated hash lookups (NFC) (PR #108322)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Sep 11 20:01:32 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/108322.diff
1 Files Affected:
- (modified) mlir/lib/Transforms/Mem2Reg.cpp (+1-2)
``````````diff
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)) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/108322
More information about the Mlir-commits
mailing list