diff options
author | Matthias Springer <me@m-sp.org> | 2025-03-06 08:48:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-06 08:48:51 +0100 |
commit | a6151f4e237075919c12a120c391a8b6c6a5000c (patch) | |
tree | 7a6f4b3e47e2f69a5ec7b8e988f9e9be38928eed /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp | |
parent | 87976ca45f4fa983ef92bf8f43a54472ec354e00 (diff) | |
download | llvm-a6151f4e237075919c12a120c391a8b6c6a5000c.zip llvm-a6151f4e237075919c12a120c391a8b6c6a5000c.tar.gz llvm-a6151f4e237075919c12a120c391a8b6c6a5000c.tar.bz2 |
[mlir][IR] Move `match` and `rewrite` functions into separate class (#129861)
The vast majority of rewrite / conversion patterns uses a combined
`matchAndRewrite` instead of separate `match` and `rewrite` functions.
This PR optimizes the code base for the most common case where users
implement a combined `matchAndRewrite`. There are no longer any `match`
and `rewrite` functions in `RewritePattern`, `ConversionPattern` and
their derived classes. Instead, there is a `SplitMatchAndRewriteImpl`
class that implements `matchAndRewrite` in terms of `match` and
`rewrite`.
Details:
* The `RewritePattern` and `ConversionPattern` classes are simpler
(fewer functions). Especially the `ConversionPattern` class, which now
has 5 fewer functions. (There were various `rewrite` overloads to
account for 1:1 / 1:N patterns.)
* There is a new class `SplitMatchAndRewriteImpl` that derives from
`RewritePattern` / `OpRewritePatern` / ..., along with a type alias
`RewritePattern::SplitMatchAndRewrite` for convenience.
* Fewer `llvm_unreachable` are needed throughout the code base. Instead,
we can use pure virtual functions. (In cases where users previously had
to implement `rewrite` or `matchAndRewrite`, etc.)
* This PR may also improve the number of [`-Woverload-virtual`
warnings](https://discourse.llvm.org/t/matchandrewrite-hiding-virtual-functions/84933)
that are produced by GCC. (To be confirmed...)
Note for LLVM integration: Patterns with separate `match` / `rewrite`
implementations, must derive from `X::SplitMatchAndRewrite` instead of
`X`.
---------
Co-authored-by: River Riddle <riddleriver@gmail.com>
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
0 files changed, 0 insertions, 0 deletions