Hi,
I want to create a func::CallOp via C++, but even though I call
mlir::func::CallOp::create(*builder_, *location_, callee, *operands_)
with one operand, I get
error: 'func.call' op incorrect number of operands for callee
Here’s the output MLIR
"builtin.module"() <{sym_name = "root"}> ({
"func.func"() <{function_type = (tensor<f64>) -> tensor<f64>, sym_name = "f1"}> ({
^bb0(%arg0: tensor<f64>):
%2 = "stablehlo.add"(%arg0, %arg0) : (tensor<f64>, tensor<f64>) -> tensor<f64>
"func.return"(%2) : (tensor<f64>) -> ()
}) : () -> ()
"func.func"() <{function_type = () -> tensor<f64>, sym_name = "main"}> ({
%0 = "stablehlo.constant"() <{value = dense<1.000000e+00> : tensor<f64>}> : () -> tensor<f64>
%1 = "func.call"() <{callee = @f1}> : () -> tensor<f64>
"func.return"(%1) : (tensor<f64>) -> ()
}) : () -> ()
}) : () -> ()
which makes no mention of %0 (or indeed any value) in func.call. Debugging,
printf(“%zu\n”, operands_->getTypes().size());
operands_->getTypes()[0].dump();
produces 1 and tensor<f64>, as expected.