[Mlir-commits] [mlir] [mlir][bufferization] handle exit aliases in buffer-loop-hoisting (PR #226951)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Oct 1 03:18:45 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
index 3c62cf521..9e6caf754 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferOptimizations.cpp
@@ -72,9 +72,9 @@ static bool isSequentialLoop(Operation *op) {
/// Returns true if an allocation in the before region 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(
- memref::AllocOp alloc, scf::WhileOp loop,
- const BufferViewFlowAnalysis::ValueSetT &aliases) {
+static bool
+canHoistFromWhile(memref::AllocOp alloc, 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()) ||
@@ -394,7 +394,9 @@ struct BufferAllocationHoistingState : BufferAllocationHoistingStateBase {
}
/// Returns true if the given operation does not represent a loop.
- bool isLegalPlacement(Operation *op, Operation *scopeOp) { return !isLoop(op); }
+ bool isLegalPlacement(Operation *op, Operation *scopeOp) {
+ return !isLoop(op);
+ }
/// Returns true if the given operation should be considered for hoisting.
static bool shouldHoistOpType(Operation *op) {
@@ -434,8 +436,9 @@ struct BufferAllocationLoopHoistingState : BufferAllocationHoistingStateBase {
auto alloc = allocValue.getDefiningOp<memref::AllocOp>();
if (!loop || !alloc)
return false;
- // Moving outside the analysis scope leaves liveness information unavailable.
- // An unreachable parent block has no dominator node for the placement walk.
+ // Moving outside the analysis scope leaves liveness information
+ // unavailable. An unreachable parent block has no dominator node for the
+ // placement walk.
if (!scopeOp->isProperAncestor(op) ||
!dominators->isReachableFromEntry(op->getBlock()))
return false;
``````````
</details>
https://github.com/llvm/llvm-project/pull/226951
More information about the Mlir-commits
mailing list