Currently, MLIR does not provide a function hook that allows users to directly modify the verifier. However, you can achieve similar goals through any of the following indirect methods:
You can define a custom interface with verifier and regist it to funcop.
You can define a custom func op on you own dialect and verify it(need some conversion).
As mentioned by matthias, you can also write a custom verification pass.
Thanks for the reply, but I am not thinking of adding a custom verification pass, since I should invoke every single verification pass before and after some passes if I use a custom pass. The reason I was trying to use the default verifier was because it would be automatically called with the passDriver.
For FuncOp in particular, downstream projects are generally encouraged to define their own versions, possibly implementing FunctionOpInterface. It’s pretty tricky to define a common implementation for such a generic operation.