This allows for defining simple patterns in a single line. The lambda
body of a Pattern expects a single operation rewrite statement:
Pattern => replace op<my_dialect.foo>(operands: ValueRange) with operands;
Paths
| Differential D115835
[PDLL] Add support for single line lambda-like patterns ClosedPublic Authored by rriddle on Dec 15 2021, 6:27 PM.
Details Summary This allows for defining simple patterns in a single line. The lambda Pattern => replace op<my_dialect.foo>(operands: ValueRange) with operands;
Diff Detail
Event TimelineHerald added subscribers: sdasgup3, wenzhicui, wrengr and 20 others. · View Herald TranscriptDec 15 2021, 6:27 PM rriddle added a child revision: D115836: [PDLL] Add support for user defined constraint and rewrite functions.Dec 15 2021, 6:28 PM nicolasvasilache added inline comments.
This revision is now accepted and ready to land.Dec 15 2021, 11:15 PM jpienaar added inline comments.
rriddle marked 4 inline comments as done.
Closed by commit rG3d8b90601211: [PDLL] Add support for single line lambda-like patterns (authored by rriddle). · Explain WhyFeb 10 2022, 12:49 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 407650 mlir/lib/Tools/PDLL/Parser/Parser.cpp
mlir/test/mlir-pdll/Parser/pattern-failure.pdll
mlir/test/mlir-pdll/Parser/pattern.pdll
|
I get that you don't pop in the failure mode, I am wondering still if an RAAI guard (llvm::scope_exit IIRC or DeclScopeGuard) would be a nice thing to have in general (in case this pattern ends up repeating).