-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
/// Check whether `op` can have a write effect on value `val`
static bool opHasWriteEffect(::mlir::Value val, ::mlir::Operation *op) {
// Check whether the operation `op` has write effect on the memory.
if (!llvm::is_contained(val.getUsers(), op))
return false;
if (auto memEffect = ::mlir::dyn_cast<::mlir::MemoryEffectOpInterface>(op)) {
::mlir::SmallVector<::mlir::MemoryEffects::EffectInstance, 1> effects;
memEffect.getEffects(effects);
return llvm::any_of(
effects, [](::mlir::MemoryEffects::EffectInstance effect) {
return ::mlir::isa<::mlir::MemoryEffects::Write>(effect.getEffect());
});
}
// Op does not implement the interface, assume effect is present
return true;
}
This function not only finds the op written to val, but also the op written from val to other memory. However, according to the meaning of the comment, it should only find the op written to val. Is this an error in the comment or in the code implementation?
Metadata
Metadata
Assignees
Labels
No labels