@@ -31,22 +31,19 @@ class CallOpConversion final : public OpConversionPattern<func::CallOp> {
31
31
LogicalResult
32
32
matchAndRewrite (func::CallOp callOp, OpAdaptor adaptor,
33
33
ConversionPatternRewriter &rewriter) const override {
34
- // Multiple results func was not converted to `emitc.func`.
34
+ // Multiple results func cannot be converted to `emitc.func`.
35
35
if (callOp.getNumResults () > 1 )
36
36
return rewriter.notifyMatchFailure (
37
37
callOp, " only functions with zero or one result can be converted" );
38
38
39
39
// Convert the original function results.
40
- Type resultTy = nullptr ;
41
- if (callOp.getNumResults ()) {
42
- resultTy = typeConverter->convertType (callOp.getResult (0 ).getType ());
43
- if (!resultTy)
44
- return rewriter.notifyMatchFailure (
45
- callOp, " function return type conversion failed" );
40
+ SmallVector<Type> types;
41
+ if (failed (typeConverter->convertTypes (callOp.getResultTypes (), types))) {
42
+ return rewriter.notifyMatchFailure (
43
+ callOp, " function return type conversion failed" );
46
44
}
47
-
48
45
rewriter.replaceOpWithNewOp <emitc::CallOp>(
49
- callOp, resultTy , adaptor.getOperands (), callOp->getAttrs ());
46
+ callOp, types , adaptor.getOperands (), callOp->getAttrs ());
50
47
51
48
return success ();
52
49
}
0 commit comments