[Mlir-commits] [mlir] [mlir][affine] Avoid fusion when the sibling loop has result usage (PR #216564)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Aug 29 03:50:11 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,h -- mlir/include/mlir/Dialect/Affine/LoopFusionUtils.h mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.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/Affine/Transforms/LoopFusion.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
index 063c44027..300e2cd71 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
@@ -142,8 +142,9 @@ static void replaceInits(RewriterBase &rewriter, AffineForOp forOp,
[&]() { forOp.getInitsMutable().assign(inits); });
}
-static AffineForOp getAffineForOpWithResults(ValueRange values,
- SmallVectorImpl<unsigned> &indices) {
+static AffineForOp
+getAffineForOpWithResults(ValueRange values,
+ SmallVectorImpl<unsigned> &indices) {
assert(!values.empty() && "expected values to forward");
auto firstResult = dyn_cast<OpResult>(values.front());
assert(firstResult && "expected forwarded values to be operation results");
@@ -1480,8 +1481,8 @@ public:
if (hasUsedSiblingResults) {
SmallVector<Value> usedClonedSibResults;
SmallVector<Value> usedSibInits;
- for (auto [oldResult, init] :
- llvm::zip(sibAffineForOp->getResults(), sibAffineForOp.getInits())) {
+ for (auto [oldResult, init] : llvm::zip(sibAffineForOp->getResults(),
+ sibAffineForOp.getInits())) {
if (oldResult.use_empty())
continue;
usedClonedSibResults.push_back(mapper.lookup(oldResult));
@@ -1489,8 +1490,8 @@ public:
}
SmallVector<Value> replacementResults =
- forwardValuesThroughAffineForNest(
- usedClonedSibResults, usedSibInits, dstAffineForOp);
+ forwardValuesThroughAffineForNest(usedClonedSibResults,
+ usedSibInits, dstAffineForOp);
unsigned nextReplacement = 0;
for (Value oldResult : sibAffineForOp->getResults()) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/216564
More information about the Mlir-commits
mailing list