@@ -344,7 +344,7 @@ static LogicalResult getFuncOpsOrderedByCalls(
344344 }
345345
346346 // Put all other functions in the list of remaining functions. These are
347- // functions that call each each circularly.
347+ // functions that call each other circularly.
348348 for (auto it : numberCallOpsContainedInFuncOp)
349349 remainingFuncOps.push_back (it.first );
350350
@@ -387,8 +387,13 @@ mlir::bufferization::analyzeModuleOp(ModuleOp moduleOp,
387387 " expected that function boundary bufferization is activated" );
388388 FuncAnalysisState &funcState = getOrCreateFuncAnalysisState (state);
389389
390- // A list of functions in the order in which they are analyzed + bufferized.
391- SmallVector<func::FuncOp> orderedFuncOps, remainingFuncOps;
390+ // A list of non-circular functions in the order in which they are analyzed
391+ // and bufferized.
392+ SmallVector<func::FuncOp> orderedFuncOps;
393+ // A list of all other functions. I.e., functions that call each other
394+ // recursively. For these, we analyze the function body but not the function
395+ // boundary.
396+ SmallVector<func::FuncOp> remainingFuncOps;
392397
393398 // A mapping of FuncOps to their callers.
394399 FuncCallerMap callerMap;
@@ -397,8 +402,8 @@ mlir::bufferization::analyzeModuleOp(ModuleOp moduleOp,
397402 remainingFuncOps, callerMap)))
398403 return failure ();
399404
400- // Analyze ops in order. Starting with functions that are not calling any
401- // other functions.
405+ // Analyze functions in order. Starting with functions that are not calling
406+ // any other functions.
402407 for (func::FuncOp funcOp : orderedFuncOps) {
403408 if (!state.getOptions ().isOpAllowed (funcOp))
404409 continue ;
@@ -422,7 +427,7 @@ mlir::bufferization::analyzeModuleOp(ModuleOp moduleOp,
422427 funcState.analyzedFuncOps [funcOp] = FuncOpAnalysisState::Analyzed;
423428 }
424429
425- // Analyze all other ops .
430+ // Analyze all other functions. All function boundary analyses are skipped .
426431 for (func::FuncOp funcOp : remainingFuncOps) {
427432 if (!state.getOptions ().isOpAllowed (funcOp))
428433 continue ;
@@ -459,8 +464,13 @@ LogicalResult mlir::bufferization::bufferizeModuleOp(
459464 " expected that function boundary bufferization is activated" );
460465 IRRewriter rewriter (moduleOp.getContext ());
461466
462- // A list of functions in the order in which they are analyzed + bufferized.
463- SmallVector<func::FuncOp> orderedFuncOps, remainingFuncOps;
467+ // A list of non-circular functions in the order in which they are analyzed
468+ // and bufferized.
469+ SmallVector<func::FuncOp> orderedFuncOps;
470+ // A list of all other functions. I.e., functions that call each other
471+ // recursively. For these, we analyze the function body but not the function
472+ // boundary.
473+ SmallVector<func::FuncOp> remainingFuncOps;
464474
465475 // A mapping of FuncOps to their callers.
466476 FuncCallerMap callerMap;
0 commit comments