Skip to content

Commit 7a1d5f3

Browse files
committed
revert unnecessary change
1 parent 7d4273a commit 7a1d5f3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,12 @@ ParseResult MapOp::parse(OpAsmParser &parser, OperationState &result) {
15541554
return failure();
15551555

15561556
if (payloadOpName.has_value()) {
1557-
addBodyWithPayloadOp(parser, result, payloadOpName.value(), payloadOpAttrs,
1558-
ArrayRef(result.operands), false, false);
1557+
if (!result.operands.empty())
1558+
addBodyWithPayloadOp(parser, result, payloadOpName.value(),
1559+
payloadOpAttrs, ArrayRef(result.operands), false,
1560+
false);
1561+
else
1562+
result.addRegion();
15591563
} else {
15601564
SmallVector<OpAsmParser::Argument> regionArgs;
15611565
if (parser.parseArgumentList(regionArgs, OpAsmParser::Delimiter::Paren,
@@ -1657,11 +1661,13 @@ LogicalResult MapOp::verify() {
16571661
auto *bodyBlock = getBody();
16581662
auto blockArgs = bodyBlock->getArguments();
16591663

1660-
// Checks if the number of `inputs` match the arity of the `mapper` region.
1664+
// Checks if the number of `inputs` + `init` match the arity of the `mapper`
1665+
// region.
16611666
if (getInputs().size() + 1 != blockArgs.size())
16621667
return emitOpError() << "expects number of operands to match the arity of "
16631668
"mapper, but got: "
1664-
<< getInputs().size() << " and " << blockArgs.size();
1669+
<< getInputs().size() + 1 << " and "
1670+
<< blockArgs.size();
16651671

16661672
// The parameters of mapper should all match the element type of inputs.
16671673
for (const auto &[bbArgType, inputArg] :

0 commit comments

Comments
 (0)