This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add a new RewritePattern::hasBoundedRewriteRecursion hook.
ClosedPublic

Authored by rriddle on Apr 9 2020, 12:49 AM.

Details

Summary

Some pattern rewriters, like dialect conversion, prohibit the unbounded recursion(or reapplication) of patterns on generated IR. Most patterns are not written with recursive application in mind, so will generally explode the stack if uncaught. This revision adds a hook to RewritePattern, hasBoundedRewriteRecursion, to signal that the pattern can safely be applied to the generated IR of a previous application of the same pattern. This allows for establishing a contract between the pattern and rewriter that the pattern knows and can handle the potential recursive application.

Diff Detail

Event Timeline

rriddle created this revision.Apr 9 2020, 12:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 9 2020, 12:49 AM
This revision is now accepted and ready to land.Apr 9 2020, 6:16 AM
rriddle updated this revision to Diff 256349.Apr 9 2020, 11:53 AM

Update a few patterns to take advantage of the hook.

stellaraccident accepted this revision.Apr 9 2020, 12:30 PM
stellaraccident added a subscriber: stellaraccident.

Thanks - this solves for the case I was talking to you about from my end.

This revision was automatically updated to reflect the committed changes.