[Mlir-commits] [mlir] [mlir][bufferization] Hoist allocations through exactly-once regions (PR #224921)
Federico Bruzzone
llvmlistbot at llvm.org
Sun Sep 20 07:44:18 PDT 2026
================
@@ -367,12 +369,24 @@ struct BufferAllocationLoopHoistingState : BufferAllocationHoistingStateBase {
return dependencyBlock ? dependencyBlock : nullptr;
}
- /// Returns true if the given operation represents a loop with sequential
- /// execution semantics and one of the aliases caused the
- /// `aliasDominatorBlock` to be "above" the block of the given loop operation.
- /// If this is the case, it indicates that the allocation is passed via a back
- /// edge.
- bool isLegalPlacement(Operation *op) {
+ /// Returns true if the placement search can cross the given parent operation.
+ /// Non-loop regions may be crossed if the current region is executed exactly
+ /// once. Loops must have sequential execution semantics and must not violate
+ /// the alias back-edge constraint.
+ bool isLegalPlacement(Operation *op, Region *region) {
+ if (!isLoop(op)) {
+ auto branchOp = dyn_cast<RegionBranchOpInterface>(op);
+ if (!branchOp)
+ return false;
----------------
FedericoBruzzone wrote:
Prob we can just use something like:
```suggestion
auto branchOp = cast<RegionBranchOpInterface>(op);
```
https://github.com/llvm/llvm-project/pull/224921
More information about the Mlir-commits
mailing list