Should I pass values or references of mlir types as function arguments


Are Op and Value lightweight references? Which of the following is suggested?

// style A
void myfunc(mlir::SomeOp& op, mlir::Value& value);

// style B
void myfunc(mlir::SomeOp op, mlir::Value value);

Thanks in advance :smiley:

Style B - the Op and Value types are effectively thin c++ wrappers around pointers meant to be passed by value.

1 Like