[Mlir-commits] [mlir] [mlir][affine] Fix inverted epilogue check in affineForOpBodySkew (PR #217553)
Babar Khan
llvmlistbot at llvm.org
Thu Aug 20 01:27:14 PDT 2026
https://github.com/BabarZKhan created https://github.com/llvm/llvm-project/pull/217553
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.
>From 65798bd72cb1fdf946e17d26c8e7d166ccb313b2 Mon Sep 17 00:00:00 2001
From: BabarZKhan <bzamankhan at gmail.com>
Date: Thu, 20 Aug 2026 10:06:04 +0200
Subject: [PATCH] [mlir][affine] Fix inverted epilogue check in
affineForOpBodySkew
---
mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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();
More information about the Mlir-commits
mailing list