HomePhabricator

[mlir] Add support for filtering patterns based on debug names and labels

Authored by rriddle on Jun 2 2021, 11:43 AM.

Description

[mlir] Add support for filtering patterns based on debug names and labels

This revision allows for attaching "debug labels" to patterns, and provides to FrozenRewritePatternSet for filtering patterns based on these labels (in addition to the debug name of the pattern). This will greatly simplify the ability to write tests targeted towards specific patterns (in cases where many patterns may interact), will also simplify debugging pattern application by observing how application changes when enabling/disabling specific patterns.

To enable better reuse of pattern rewrite options between passes, this revision also adds a new PassUtil.td file to the Rewrite/ library that will allow for passes to easily hook into a common interface for pattern debugging. Two options are used to seed this utility, disable-patterns and enable-patterns, which are used to enable the filtering behavior indicated above.

Differential Revision: https://reviews.llvm.org/D102441