[Mlir-commits] [mlir] [mlir][bufferization] handle exit aliases in buffer-loop-hoisting (PR #226951)
Matteo Di Iorio
llvmlistbot at llvm.org
Mon Oct 12 02:52:36 PDT 2026
================
@@ -66,6 +69,49 @@ 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
----------------
splicer3 wrote:
`scf.for` goes through the same `isLegalPlacement` check, which already rejects loops with the `HasParallelRegion` trait. That stops hoisting across scf.parallel, but there is no additional protection for parallel loops without that trait, as in #226090.
I added the function-parent check to keep the new while fallback from exposing the same problem, but I think I can just use the existing stopping condition and allow a non-loop parent or one with HasParallelRegion. That will let the allocation move before the `while` and also keep it inside the parent.
https://github.com/llvm/llvm-project/pull/226951
More information about the Mlir-commits
mailing list