Page MenuHomePhabricator

[mlir][NFC] Move around the code related to PatternRewriting to improve layering
ClosedPublic

Authored by rriddle on Oct 9 2020, 1:52 AM.

Details

Summary

There are several pieces of pattern rewriting infra in IR/ that really shouldn't be there. This revision moves those pieces to a better location such that they are easier to evolve in the future(e.g. with PDL). More concretely this revision does the following:

  • Create a Transforms/GreedyPatternRewriteDriver.h and move the apply*andFold methods there.

The definitions for these methods are already in Transforms/ so it doesn't make sense for the declarations to be in IR.

  • Create a new lib/Rewrite library and move PatternApplicator there.

This new library will be focused on applying rewrites, and will also include compiling rewrites with PDL.

Depends On D86258

Diff Detail

Event Timeline

rriddle created this revision.Oct 9 2020, 1:52 AM
rriddle requested review of this revision.Oct 9 2020, 1:52 AM
nicolasvasilache accepted this revision.Oct 9 2020, 2:05 AM

Mark the commit as NFC in the title ?

This revision is now accepted and ready to land.Oct 9 2020, 2:05 AM
rriddle retitled this revision from [mlir] Move around the code related to PatternRewriting to improve layering to [mlir][NFC] Move around the code related to PatternRewriting to improve layering.Oct 19 2020, 3:23 PM

Mark the commit as NFC in the title ?

Done. Thanks for the review!

silvas accepted this revision.Oct 19 2020, 7:58 PM
silvas added inline comments.
mlir/include/mlir/Rewrite/PatternApplicator.h
2

micro-nit: stray == in the middle of the -'s

mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
2

nit: DialectConversion.h is wrong in the first line

(btw, that's why I hate the first line of these headers. I like to just use //===----------------------------------------------------------------------===// for the top one).

Nice! This is a lot easier to understand :)

jpienaar accepted this revision.Oct 19 2020, 8:57 PM
This revision was landed with ongoing or failed builds.Mon, Oct 26, 6:05 PM
This revision was automatically updated to reflect the committed changes.