Skip to content

Commit 7ddf771

Browse files
authored
[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.
1 parent f779ebc commit 7ddf771

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mlir/lib/Transforms/CSE.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ bool CSEDriver::hasOtherSideEffectingOpInBetween(Operation *fromOp,
196196
Operation *nextOp = fromOp->getNextNode();
197197
auto result =
198198
memEffectsCache.try_emplace(fromOp, std::make_pair(fromOp, nullptr));
199-
if (result.second) {
199+
if (!result.second) {
200200
auto memEffectsCachePair = result.first->second;
201201
if (memEffectsCachePair.second == nullptr) {
202202
// No MemoryEffects::Write has been detected until the cached operation.

0 commit comments

Comments
 (0)