This is an archive of the discontinued LLVM Phabricator instance.

[mlir][doc] Fix usage of PatternApplicator.
ClosedPublic

Authored by ingomueller-net on May 9 2022, 8:06 AM.

Details

Summary

The constructor of PatternApplicator doesn't have a constructor that
accepts only a RewritePatternSet as currently used in the example
code in PatternRewriter.md. Instead, one has to turn it into a
FrozenRewritePatternSet.

Diff Detail

Event Timeline

ingomueller-net created this revision.May 9 2022, 8:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 8:06 AM
ingomueller-net requested review of this revision.May 9 2022, 8:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 8:06 AM
nicolasvasilache accepted this revision.Jul 14 2022, 2:06 AM
This revision is now accepted and ready to land.Jul 14 2022, 2:06 AM
This revision was automatically updated to reflect the committed changes.

It seems like this is the inverse direction than what is needed: The constructor you point to constructs a FrozenRewritePatternSet from a RewritePatternSet (which freezes the set); however, in the example, we have a FrozenRewritepatternSet that is given to a function that expected a RewritePatternSet (which would "unfreeze" the set, which I guess shouldn't be possible). My commit makes the function accept a FrozenRewritePatternSet instead, but one could also never freeze it in the first place. I don't really understand the code, so any more informed suggestions are welcome!