[Mlir-commits] [mlir] [mlir][affine] Fix inverted epilogue check in affineForOpBodySkew (PR #217553)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Aug 20 01:28:06 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-affine
Author: Babar Khan (BabarZKhan)
<details>
<summary>Changes</summary>
So, my understanding is, when `unrollPrologueEpilogue` is enabled, `affineForOpBodySkew` aims to fully unroll both the generated prologue and epilogue. The epilogue condition incorrectly checks `!epilogue`, may be causing valid epilogues to be skipped and passing a null operation to `loopUnrollFull.`
**trivial fix:**
replace the condition with `epilogue && epilogue != prologue`. So that , a valid epilogue is unrolled exactly once.
---
Full diff: https://github.com/llvm/llvm-project/pull/217553.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp (+1-1)
``````````diff
diff --git a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
index 90bc57e950cf1..293356b164a36 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
@@ -352,7 +352,7 @@ LogicalResult mlir::affine::affineForOpBodySkew(AffineForOp forOp,
if (unrollPrologueEpilogue && prologue)
(void)loopUnrollFull(prologue);
- if (unrollPrologueEpilogue && !epilogue && epilogue != prologue)
+ if (unrollPrologueEpilogue && epilogue && epilogue != prologue)
(void)loopUnrollFull(epilogue);
return success();
``````````
</details>
https://github.com/llvm/llvm-project/pull/217553
More information about the Mlir-commits
mailing list