[Mlir-commits] [mlir] [mlir][affine] Add fold logic when the affine.yield has IV as operand in the AffineForEmptyLoopFolder (PR #164064)
Matthias Springer
llvmlistbot at llvm.org
Tue Oct 28 09:34:59 PDT 2025
================
@@ -2610,6 +2610,21 @@ static std::optional<uint64_t> getTrivialConstantTripCount(AffineForOp forOp) {
return ub - lb <= 0 ? 0 : (ub - lb + step - 1) / step;
}
+/// Calculate the constant value of the loop's induction variable for its last
+/// trip, construct an OpFoldResult using this value and return it.
+static OpFoldResult getConstantInductionVarForLastTrip(AffineForOp forOp) {
----------------
matthias-springer wrote:
This always returns an `IntegerAttr`, so I would change the result type to `int64_t` and construct the `OpFoldResult` at the call site.
https://github.com/llvm/llvm-project/pull/164064
More information about the Mlir-commits
mailing list