diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp --- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp +++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ComprehensiveBufferize.cpp @@ -616,6 +616,24 @@ return success(); } +/// Analyze all ops that are contained in `op`. +static LogicalResult inPlaceAnalysis(Operation *op, + BufferizationAliasInfo &aliasInfo, + const DominanceInfo &domInfo, + unsigned analysisFuzzerSeed = 0) { + // Collect ops so we can build our own reverse traversal. + SmallVector ops; + op->walk([&](Operation *op) { + // No tensors => no buffers. + if (none_of(op->getOperandTypes(), isaTensor) && + none_of(op->getResultTypes(), isaTensor)) + return; + ops.push_back(op); + }); + + return inPlaceAnalysis(ops, aliasInfo, domInfo, analysisFuzzerSeed); +} + /// Assert that the current bufferization decisions are consistent. static LogicalResult checkAliasInfoConsistency(Operation *op, const DominanceInfo &domInfo, @@ -678,19 +696,9 @@ if (failed(checkAliasInfoConsistency(op, domInfo, aliasInfo))) return failure(); - // Collect ops so we can build our own reverse traversal. - SmallVector ops; - op->walk([&](Operation *op) { - // No tensors => no buffers. - if (none_of(op->getOperandTypes(), isaTensor) && - none_of(op->getResultTypes(), isaTensor)) - return; - ops.push_back(op); - }); - // If the analysis fails, just return. if (failed( - inPlaceAnalysis(ops, aliasInfo, domInfo, options.analysisFuzzerSeed))) + inPlaceAnalysis(op, aliasInfo, domInfo, options.analysisFuzzerSeed))) return failure(); for (const std::unique_ptr &step :