Skip to content

Commit 14dacb0

Browse files
author
Simon Camphausen
committed
[mlir][EmitC] func-to-emitc: Fix conversion for call ops with zero arguments
1 parent e4790ce commit 14dacb0

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

mlir/lib/Conversion/FuncToEmitC/FuncToEmitC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CallOpConversion final : public OpConversionPattern<func::CallOp> {
3838

3939
rewriter.replaceOpWithNewOp<emitc::CallOp>(
4040
callOp,
41-
callOp.getNumResults() ? callOp.getResult(0).getType() : nullptr,
41+
callOp.getNumResults() ? callOp.getResult(0).getType() : TypeRange{},
4242
adaptor.getOperands(), callOp->getAttrs());
4343

4444
return success();

mlir/test/Conversion/FuncToEmitC/func-to-emitc.mlir

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,19 @@ func.func @call(%arg0: i32) -> i32 {
5858

5959
// CHECK-LABEL: emitc.func private @return_i32(i32) -> i32 attributes {specifiers = ["extern"]}
6060
func.func private @return_i32(%arg0: i32) -> i32
61+
62+
// -----
63+
64+
// CHECK-LABEL: emitc.func private @return_void() attributes {specifiers = ["static"]}
65+
// CHECK-NEXT: emitc.return
66+
func.func private @return_void() {
67+
return
68+
}
69+
70+
// CHECK-LABEL: emitc.func @call()
71+
// CHECK-NEXT: emitc.call @return_void() : () -> ()
72+
// CHECK-NEXT: emitc.return
73+
func.func @call() {
74+
call @return_void() : () -> ()
75+
return
76+
}

0 commit comments

Comments
 (0)