summaryrefslogtreecommitdiff
path: root/mlir/lib/Query/Query.cpp
AgeCommit message (Collapse)Author
2025-10-30[mlir] Fix use-after-move issues (#165660)Slava Gurevich
This patch addresses two use-after-move issues: 1. `Timing.cpp` A variable was std::moved and then immediately passed to an `assert()` check. Since the moved-from state made the assertion condition trivially true, the check was effectively useless. The `assert()` is removed. 2. `Query.cpp` The `matcher` object was moved-from and then subsequently used as if it still retained valid state. The fix ensures no subsequent use for the moved-from variable. Testing: `ninja check-mlir`
2025-08-28[MLIR] Apply clang-tidy fixes for llvm-qualified-auto in Query.cpp (NFC)Mehdi Amini
2025-07-22[mlir][NFC] update `mlir/lib` create APIs (26/n) (#149933)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info. --------- Co-authored-by: Tobias Gysi <tobias.gysi@nextsilicon.com>
2025-07-15[mlir] Remove unused includes (NFC) (#148872)Kazu Hirata
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-07-01[mlir] Reapply 141423 mlir-query combinators plus fix (#146156)Denzel-Brian Budii
An uninitialized variable that caused a crash (https://lab.llvm.org/buildbot/#/builders/164/builds/11004) was identified using the memory analyzer, leading to the reversion of https://github.com/llvm/llvm-project/pull/141423. This pull request reapplies the previously reverted changes and includes the fix, which has been tested locally following the steps at https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild. Note: the fix is included as part of the second commit
2025-06-24Revert "[mlir] Improve mlir-query by adding matcher combinators" (#145534)Qinkun Bao
Reverts llvm/llvm-project#141423
2025-06-17[mlir] Improve mlir-query by adding matcher combinators (#141423)Denzel-Brian Budii
Whereas backward-slice matching provides support to limit traversal by specifying the desired depth level, this pull request introduces support for limiting traversal with a nested matcher (adding forward-slice also). It also adds support for variadic operators, including `anyOf` and `allOf`. Rather than simply stopping traversal when an operation named foo is encountered, one can now define a matcher that specifies different exit conditions. Variadic support implementation within mlir-query is very similar to clang-query.
2025-05-13[mlir] Improve mlir-query tool by implementing `getBackwardSlice` and ↵Denzel-Brian Budii
`getForwardSlice` matchers (#115670) Improve mlir-query tool by implementing `getBackwardSlice` and `getForwardSlice` matchers. As an addition `SetQuery` also needed to be added to enable custom configuration for each query. e.g: `inclusive`, `omitUsesFromAbove`, `omitBlockArguments`. Note: backwardSlice and forwardSlice algoritms are the same as the ones in `mlir/lib/Analysis/SliceAnalysis.cpp` Example of current matcher. The query was made to the file: `mlir/test/mlir-query/complex-test.mlir` ```mlir ./mlir-query /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir -c "match getDefinitions(hasOpName(\"arith.add f\"),2)" Match #1: /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:5:8: %0 = linalg.generic {indexing_maps = [#map, #map], iterator_types = ["parallel", "parallel"]} ins(%arg0 : tensor<5x5xf32>) outs(%arg1 : tensor<5x5xf32>) { ^ /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:7:10: note: "root" binds here %2 = arith.addf %in, %in : f32 ^ Match #2: /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:10:16: %collapsed = tensor.collapse_shape %0 [[0, 1]] : tensor<5x5xf32> into tensor<25xf32> ^ /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:13:11: %c2 = arith.constant 2 : index ^ /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:14:18: %extracted = tensor.extract %collapsed[%c2] : tensor<25xf32> ^ /home/dbudii/personal/llvm-project/mlir/test/mlir-query/complex-test.mlir:15:10: note: "root" binds here %2 = arith.addf %extracted, %extracted : f32 ^ 2 matches. ```
2025-04-30[mlir] allow function type cloning to fail (#137130)Oleksandr "Alex" Zinenko
`FunctionOpInterface` assumed the fact that the function type (attribute of the operation) can be cloned with arbirary lists of function arguments and results to support argument and result list mutation. This is not always correct, in particular, LLVM dialect functions require exactly one result making it impossible to erase the result. Allow function type cloning to fail and propagate this failure through various APIs that use it. The common assumption is that existing IR has not been modified. Fixes #131142. Reland a8c7ecdcbc3e89b493b495c6831cc93671c3b844 / #136300.
2025-04-18Revert "[mlir] allow function type cloning to fail (#136300)"Kazu Hirata
This reverts commit 20a104a7d6423784dab04371a5ca728cc27a15a9. Buildbot failure: https://lab.llvm.org/buildbot/#/builders/157/builds/25688 I've reproduced the build failure.
2025-04-18[mlir] allow function type cloning to fail (#136300)Oleksandr "Alex" Zinenko
`FunctionOpInterface` assumed the fact that the function type (attribute of the operation) can be cloned with arbirary lists of function arguments and results to support argument and result list mutation. This is not always correct, in particular, LLVM dialect functions require exactly one result making it impossible to erase the result. Allow function type cloning to fail and propagate this failure through various APIs that use it. The common assumption is that existing IR has not been modified. Fixes #131142.
2025-04-14[mlir] Use llvm::append_range (NFC) (#135722)Kazu Hirata
2024-07-02mlir/LogicalResult: move into llvm (#97309)Ramkumar Ramachandra
This patch is part of a project to move the Presburger library into LLVM.
2024-03-04[mlir-query] Fix ambiguous overloadJacques Pienaar
gcc7 fix didn't work (but unfortunately didn't get a notification and forgot to check), this should hopefully address the ambiguous overload. I can't repro locally/trying to create docker image for testing.
2024-03-03[mlir-query] Attempt to fix gcc7 buildJacques Pienaar
I haven't tested via gcc7, but this should address the error reported.
2024-03-03Reapply "Reapply "[mlir-query] Add function extraction feature to mlir-query""Jacques Pienaar
Fix ASAN by erasing the op extracted post printing. This reverts commit 732a5cba8c739ed40a7280b5d74ca717910c2c4c.
2024-03-03Revert "Reapply "[mlir-query] Add function extraction feature to mlir-query""Jacques Pienaar
Commit fails on sanitizers. This reverts commit 22f34ea3b05537235956c99fe942aa95b88762c0.
2024-03-03Reapply "[mlir-query] Add function extraction feature to mlir-query"Jacques Pienaar
Fix build deps. This reverts commit de55c2f869925a3ed7f26e168424021c6bc46799.
2024-02-29Revert "[mlir-query] Add function extraction feature to mlir-query"Mehdi Amini
This reverts commit c66f2d0c4a46ba66fb98a2cab4e63ad90888a261. The bot is broken.
2024-02-29[mlir-query] Add function extraction feature to mlir-queryDevajith Valaparambil Sreeramaswamy
This enables specifying the extract modifier to extract all matches into a function. This currently does this very directly by converting all operands to function arguments (ones due to results of other matched ops are dropped) and all results as return values. Differential Revision: https://reviews.llvm.org/D158693
2023-10-13[mlir][mlir-query] Introduce mlir-query tool with autocomplete supportDevajith
This commit adds the initial version of the mlir-query tool, which leverages the pre-existing matchers defined in mlir/include/mlir/IR/Matchers.h The tool provides the following set of basic queries: hasOpAttrName(string) hasOpName(string) isConstantOp() isNegInfFloat() isNegZeroFloat() isNonZero() isOne() isOneFloat() isPosInfFloat() isPosZeroFloat() isZero() isZeroFloat() Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D155127