[Mlir-commits] [mlir] [mlir][bufferization] handle exit aliases in buffer-loop-hoisting (PR #226951)
Federico Bruzzone
llvmlistbot at llvm.org
Sat Oct 3 06:05:04 PDT 2026
================
@@ -66,6 +69,50 @@ static bool isSequentialLoop(Operation *op) {
return !op->hasTrait<OpTrait::HasParallelRegion>() && isLoop(op);
}
+/// Returns true if an allocation can be reused across iterations when its
+/// aliases have a common dominator outside the while loop.
+/// `aliases` must contain the complete forward alias set of the allocation.
+static bool
+canHoistFromWhile(scf::WhileOp loop,
+ const BufferViewFlowAnalysis::ValueSetT &aliases) {
+ // Further hoisting across an enclosing loop with unmodeled parallel
+ // execution could share the allocation across iterations.
+ if (!isa<FunctionOpInterface>(loop->getParentOp()) ||
+ !loop->getParentOp()->hasTrait<OpTrait::IsIsolatedFromAbove>())
----------------
FedericoBruzzone wrote:
Is the `IsIsolatedFromAbove` check still needed here, or is isa<FunctionOpInterface> enough after #228050?
https://github.com/llvm/llvm-project/pull/226951
More information about the Mlir-commits
mailing list