Skip to content

Commit 5e98ed0

Browse files
committed
Fix parser
1 parent cfb20cc commit 5e98ed0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

mlir/lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,18 @@ parseDynamicIndex(OpAsmParser &parser,
6363
}
6464

6565
OpAsmParser::UnresolvedOperand operand = OpAsmParser::UnresolvedOperand{};
66-
if (parser.parseOperand(operand)) {
67-
dynamicSize = operand;
66+
OptionalParseResult hasOperand = parser.parseOptionalOperand(operand);
67+
if (!hasOperand.has_value()) {
68+
dynamicSize = std::nullopt;
6869
return success();
6970
}
70-
return failure();
71+
72+
if (failed(hasOperand.value())) {
73+
return failure();
74+
}
75+
76+
dynamicSize = operand;
77+
return success();
7178
}
7279

7380
static void printDynamicIndex(OpAsmPrinter &printer, Operation *op,

0 commit comments

Comments
 (0)