diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/SCFInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/SCFInterfaceImpl.cpp --- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/SCFInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/SCFInterfaceImpl.cpp @@ -44,6 +44,18 @@ return true; } + // TODO: For better bufferization results, this could return `true` only if + // there is a memory write in the region. + bool isMemoryWrite(Operation *op, OpResult opResult) const { + // Similar to scf.if, results of this op are always considered memory writes + // in the analysis. + // TODO: It seems that "isMemoryWrite = true" is a useful pattern for all + // ops that may yield values that are captured from outside of the op + // (as opposed to BlockArguments of the op). This should be further explored + // in the design doc. + return true; + } + LogicalResult bufferize(Operation *op, OpBuilder &b, BufferizationState &state) const { // TODO: Add bufferization support when needed. scf.execute_region should be