[PATCH] D77782: [mlir] Add a new RewritePattern::hasBoundedRewriteRecursion hook.

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 01:03:46 PDT 2020


rriddle created this revision.
rriddle added a reviewer: mehdi_amini.
Herald added subscribers: llvm-commits, frgossen, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77782

Files:
  mlir/include/mlir/IR/PatternMatch.h
  mlir/lib/Transforms/DialectConversion.cpp
  mlir/test/Transforms/test-legalizer.mlir
  mlir/test/lib/Dialect/Test/TestOps.td
  mlir/test/lib/Dialect/Test/TestPatterns.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77782.256208.patch
Type: text/x-patch
Size: 5025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/52d1f899/attachment.bin>


More information about the llvm-commits mailing list