[Mlir-commits] [mlir] [mlir][affine] Make AffineForEmptyLoopFolder as folder function (PR #163929)
lonely eagle
llvmlistbot at llvm.org
Fri Oct 17 08:22:16 PDT 2025
================
@@ -2512,13 +2511,14 @@ static LogicalResult AffineForEmptyLoopFolder(AffineForOp forOp) {
// defined outside of the loop or any iterArg out of order.
if (!tripCount.has_value() &&
(hasValDefinedOutsideLoop || iterArgsNotInOrder))
- return failure();
+ return {};
// Bail out when the loop iterates more than once and it returns any iterArg
// out of order.
if (tripCount.has_value() && tripCount.value() >= 2 && iterArgsNotInOrder)
- return failure();
- forOp.getResults().replaceAllUsesWith(replacements);
- return success();
+ return {};
+ return llvm::map_to_vector(replacements, [&](Value replacement) {
+ return OpFoldResult(replacement);
+ });
----------------
linuxlonelyeagle wrote:
That's great! Today I learned about llvm::map_to_vector from matthias-springer, and llvm::to_vector_of from you.
https://github.com/llvm/llvm-project/pull/163929
More information about the Mlir-commits
mailing list