[Mlir-commits] [mlir] [mlir][bufferization] handle exit aliases in buffer-loop-hoisting (PR #226951)

Matthias Springer llvmlistbot at llvm.org
Sun Oct 11 17:41:54 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
----------------
matthias-springer wrote:

This seems fishy. Don't we have the same problem when hoisting allocations from `scf.for`? How is it solved there? Can `OpTrait::HasParallelRegion>` be used?

I also don't understand yet what this check protects against in its current form. Why does the loop parent have to be a function? What if the loop parent is an `scf.if` or `scf.execute_region`?

https://github.com/llvm/llvm-project/pull/226951


More information about the Mlir-commits mailing list