[Mlir-commits] [mlir] 7ddf771 - [mlir][Transforms] Fix CSE memEffectsCache handling for existing entries (NFC) (#192178)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Apr 16 01:50:37 PDT 2026
Author: zackc6
Date: 2026-04-16T10:50:31+02:00
New Revision: 7ddf7719b3dfdfb7925f5ca492c3550b240b095e
URL: https://github.com/llvm/llvm-project/commit/7ddf7719b3dfdfb7925f5ca492c3550b240b095e
DIFF: https://github.com/llvm/llvm-project/commit/7ddf7719b3dfdfb7925f5ca492c3550b240b095e.diff
LOG: [mlir][Transforms] Fix CSE memEffectsCache handling for existing entries (NFC) (#192178)
The condition on detecting cache insertion was reversed. The consequence
was that we would always go through the path of "cache hit" first, but
find that the entry was the just-inserted one and then proceed with
updating it. Subsequent attempt could go through the "cache miss" part
and the cache would never be used.
Added:
Modified:
mlir/lib/Transforms/CSE.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp
index fbd9e45cc1955..c91084ba96bb3 100644
--- a/mlir/lib/Transforms/CSE.cpp
+++ b/mlir/lib/Transforms/CSE.cpp
@@ -196,7 +196,7 @@ bool CSEDriver::hasOtherSideEffectingOpInBetween(Operation *fromOp,
Operation *nextOp = fromOp->getNextNode();
auto result =
memEffectsCache.try_emplace(fromOp, std::make_pair(fromOp, nullptr));
- if (result.second) {
+ if (!result.second) {
auto memEffectsCachePair = result.first->second;
if (memEffectsCachePair.second == nullptr) {
// No MemoryEffects::Write has been detected until the cached operation.
More information about the Mlir-commits
mailing list