[Mlir-commits] [mlir] [mlir][Transform] Extend transform.foreach to take multiple arguments (PR #93705)
Rolf Morel
llvmlistbot at llvm.org
Thu May 30 09:45:42 PDT 2024
================
@@ -1474,14 +1538,33 @@ transform::YieldOp transform::ForeachOp::getYieldOp() {
}
LogicalResult transform::ForeachOp::verify() {
- auto yieldOp = getYieldOp();
- if (getNumResults() != yieldOp.getNumOperands())
- return emitOpError() << "expects the same number of results as the "
- "terminator has operands";
- for (Value v : yieldOp.getOperands())
- if (!llvm::isa<TransformHandleTypeInterface>(v.getType()))
- return yieldOp->emitOpError("expects operands to have types implementing "
- "TransformHandleTypeInterface");
+ for (auto [targetOpt, bodyArgOpt] :
+ llvm::zip_longest(getTargets(), getBody().front().getArguments())) {
+ if (!targetOpt || !bodyArgOpt)
+ return emitOpError() << "expects the same number of targets as the body "
+ "has block arguments";
+ auto target = targetOpt.value();
+ if (target.getType() != bodyArgOpt.value().getType() ||
+ !isa<TransformHandleTypeInterface, TransformValueHandleTypeInterface,
+ TransformParamTypeInterface>(target.getType()))
----------------
rolfmorel wrote:
That makes sense. Dropped the check.
https://github.com/llvm/llvm-project/pull/93705
More information about the Mlir-commits
mailing list