This is an archive of the discontinued LLVM Phabricator instance.

[PDLL] Add a `rewrite` statement to enable complex rewrites
ClosedPublic

Authored by rriddle on Dec 7 2021, 3:23 PM.

Details

Summary

The rewrite statement allows for rewriting a given root
operation with a block of nested rewriters. The root operation is
not implicitly erased or replaced, and any transformations to it
must be expressed within the nested rewrite block. The inner body
may contain any number of other rewrite statements, variables, or
expressions.

Depends On D115298

Diff Detail

Event Timeline

rriddle created this revision.Dec 7 2021, 3:23 PM
rriddle requested review of this revision.Dec 7 2021, 3:23 PM
nicolasvasilache accepted this revision.Dec 8 2021, 4:44 AM
This revision is now accepted and ready to land.Dec 8 2021, 4:44 AM
jpienaar added inline comments.Dec 12 2021, 6:31 PM
mlir/test/mlir-pdll/Parser/stmt.pdll
198

What happens in this case? This is not as direct given the comment about no replacement happening.

If I were to have read this it would be

rewrite any op with (undefined op?)

but rewrite would make me thing a replacement is happening.

rriddle updated this revision to Diff 394170.Dec 14 2021, 12:32 AM
rriddle marked an inline comment as done.

Update

rriddle added inline comments.Dec 14 2021, 12:34 AM
mlir/test/mlir-pdll/Parser/stmt.pdll
198

Thanks for the catch. op<> should be an error in a rewrite. Also made the test more representative of something real (to prevent confusion).

This revision was landed with ongoing or failed builds.Dec 15 2021, 6:17 PM
This revision was automatically updated to reflect the committed changes.