[Mlir-commits] [mlir] [mlir] Improve mlir-query by adding matcher combinators (PR #141423)
Denzel-Brian Budii
llvmlistbot at llvm.org
Sat Jun 7 05:47:01 PDT 2025
================
@@ -129,6 +131,8 @@ LogicalResult MatchQuery::run(llvm::raw_ostream &os, QuerySession &qs) const {
finder.flattenMatchedOps(matches);
Operation *function =
extractFunction(flattenedMatches, rootOp->getContext(), functionName);
+ if (failed(verify(function)))
----------------
chios202 wrote:
I added this verifier because there are cases when the `extractFunction` is not mapping inputs and outputs correctly to block arguments. (e.g linalg.generic), leading to semantically invalid printing. Now, with the addition of `verify(function) ` it issues the following:
```
mlir-query> match getAllDefinitions(hasOpName("arith.addf"),2).extract("test")
loc("/home/dbudii/personal/llvm-project/mlir/test/mlir-query/backward-slice-union.mlir":5:8): error: 'linalg.generic' op expected as many non-induction variable region arguments as the number of input/output operands
```
Do you think this is a good addition? Should we leave this for a follow-up PR?
https://github.com/llvm/llvm-project/pull/141423
More information about the Mlir-commits
mailing list