[mlir] Add a new RewritePattern::hasBoundedRewriteRecursion hook.
authorRiver Riddle <riddleriver@gmail.com>
Thu, 9 Apr 2020 19:38:52 +0000 (12:38 -0700)
committerRiver Riddle <riddleriver@gmail.com>
Thu, 9 Apr 2020 19:42:28 +0000 (12:42 -0700)
commitbd1ccfe6df24203c494685c82b83124303d99ce0
tree472365790c53206e49eaed4845da9a1754567c47
parentb96558f5e5904d9d01298fbb1c965acb15b92781
[mlir] Add a new RewritePattern::hasBoundedRewriteRecursion hook.

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.

Differential Revision: https://reviews.llvm.org/D77782
mlir/include/mlir/IR/PatternMatch.h
mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
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