Skip to content

Commit cc0e132

Browse files
committed
parse empty operands within a bundle
1 parent 9acfb95 commit cc0e132

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,11 @@ static ParseResult parseOneOpBundle(
264264
if (p.parseLParen())
265265
return failure();
266266

267-
if (p.parseOperandList(operands))
268-
return failure();
269-
if (p.parseColon())
270-
return failure();
271-
if (p.parseTypeList(types))
272-
return failure();
273-
274-
if (p.parseRParen())
275-
return failure();
267+
if (p.parseOptionalRParen()) {
268+
if (p.parseOperandList(operands) || p.parseColon() ||
269+
p.parseTypeList(types) || p.parseRParen())
270+
return failure();
271+
}
276272

277273
opBundleOperands.push_back(std::move(operands));
278274
opBundleOperandTypes.push_back(std::move(types));

mlir/test/Target/LLVMIR/llvmir.mlir

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,6 +2641,16 @@ llvm.func @call_with_empty_opbundle() {
26412641
// CHECK-NEXT: ret void
26422642
// CHECK-NEXT: }
26432643

2644+
llvm.func @call_with_empty_opbundle_operands() {
2645+
llvm.call @foo() ["tag"()] : () -> ()
2646+
llvm.return
2647+
}
2648+
2649+
// CHECK: define void @call_with_empty_opbundle_operands() {
2650+
// CHECK-NEXT: call void @foo() [ "tag"() ]
2651+
// CHECK-NEXT: ret void
2652+
// CHECK-NEXT: }
2653+
26442654
llvm.func @call_with_opbundle() {
26452655
%0 = llvm.mlir.constant(1 : i32) : i32
26462656
%1 = llvm.mlir.constant(2 : i32) : i32

0 commit comments

Comments
 (0)