[Mlir-commits] [mlir] [Bufferization] Avoid repeated hash lookups (NFC) (PR #108925)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Sep 16 21:27:45 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-bufferization
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/108925.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp (+1-2)
``````````diff
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
index d69c194c55f7d3..829e954d53b259 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
@@ -284,9 +284,8 @@ static bool isReachable(Block *from, Block *to, ArrayRef<Block *> except) {
continue;
if (next == to)
return true;
- if (visited.contains(next))
+ if (!visited.insert(next).second)
continue;
- visited.insert(next);
for (Block *succ : next->getSuccessors())
worklist.push_back(succ);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/108925
More information about the Mlir-commits
mailing list