<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54288>54288</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] Verifier not verifying symbol uses after a FuncOp pass
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rkayaith
</td>
</tr>
</table>
<pre>
I have a pass that's creating invalid IR, but the verifier doesn't seem to be verifying it:
```cpp
// pass:
void runOnOperation() override {
FuncOp func = getOperation();
OpBuilder b(func.body());
b.create<func::CallOp>(func.getLoc(), func);
}
```
```mlir
// input.mlir:
func private @foo(%arg0: i8) {
return
}
```
```mlir
// mlir-opt --my-pass input.mlir:
"builtin.module"() ({
"builtin.func"() ({
^bb0(%arg0: i8):
"func.call"() {callee = @foo} : () -> ()
"func.return"() : () -> ()
}) {sym_name = "foo", sym_visibility = "private", type = (i8) -> ()} : () -> ()
}) : () -> ()
```
The output gets printed in generic form, but I don't actually get an error message. I have to run the result through `mlir-opt` again to get an actual error:
```
// mlir-opt --my-pass input.mlir | mlir-opt:
<stdin>:4:5: error: 'func.call' op incorrect number of operands for callee
"func.call"() {callee = @foo} : () -> ()
^
<stdin>:4:5: note: see current operation: "func.call"() {callee = @foo} : () -> ()
```
Patch with repro: https://reviews.llvm.org/D121240
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VVuPmzwQ_TXwMkpEIAR44CGXXWmlSvlUVX2tDBji1tjIl6zy77-xgWw2u91WVSuRAPbMmeMzFyrZXMonOJEzBQID0RrMiZggzjTUihLDRAdMnAlnDTx9DuI9VNagDYUzVaxlVEEjqRboYUBT2oORUE27F-9tgmQbRIcg2gabaLzqYZhW4ke8fOCr1VliLGXFURwHqpCCRPQ8iAuQiKpYQyHIdqMtwKMV9XGAFm8QJAfoqLlzC5Kr8XHYWcYbJF3hnvNZVqjAZPfKtFr689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