Skip to content

Commit efa9550

Browse files
applying minor fixes from code review
Co-authored-by: Mehdi Amini <[email protected]>
1 parent 2f3c151 commit efa9550

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mlir/lib/Interfaces/SideEffectInterfaces.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ bool mlir::hasMemoryEffectConflict(
439439
llvm::SmallVector<MemoryEffects::EffectInstance> effects;
440440
memInterface.getEffects(effects);
441441

442-
auto isDominated = dom.properlyDominates(mainOp, op);
442+
bool isDominated = dom.properlyDominates(mainOp, op);
443443

444444
// ensure op only has Write or dominated Read effects
445445
// check used resources
@@ -448,9 +448,8 @@ bool mlir::hasMemoryEffectConflict(
448448

449449
if (resourceCounts.contains(resourceID)) {
450450
if (isa<MemoryEffects::Read>(effect.getEffect())) {
451-
if (isDominated) {
451+
if (isDominated)
452452
continue; // skip dominated reads
453-
}
454453
}
455454
else if (!isa<MemoryEffects::Write>(effect.getEffect())) {
456455
return true; // count alloc/free in same region as conflict, be conservative
@@ -462,6 +461,11 @@ bool mlir::hasMemoryEffectConflict(
462461
}
463462
}
464463
}
464+
} else if (!op->hasTrait<OpTrait::HasRecursiveMemoryEffects>()) {
465+
// Otherwise, if the op does not implement the memory effect interface and
466+
// it does not have recursive side effects, then it cannot be known that the
467+
// op is conflicting or not.
468+
return true;
465469
}
466470

467471
// Recurse into the regions and ensure that nested ops don't

0 commit comments

Comments
 (0)