[all-commits] [llvm/llvm-project] 782c53: [ODS] Implement a new 'hasCanonicalizeMethod' bit ...

Chris Lattner via All-commits all-commits at lists.llvm.org
Tue Mar 23 13:46:11 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 782c534117d1a600b054475c804ba2766e6e154c
      https://github.com/llvm/llvm-project/commit/782c534117d1a600b054475c804ba2766e6e154c
  Author: Chris Lattner <clattner at nondot.org>
  Date:   2021-03-23 (Tue, 23 Mar 2021)

  Changed paths:
    M mlir/docs/Canonicalization.md
    M mlir/docs/OpDefinitions.md
    M mlir/docs/Tutorials/QuickstartRewrites.md
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp

  Log Message:
  -----------
  [ODS] Implement a new 'hasCanonicalizeMethod' bit for cann patterns.

This provides a simplified way to implement 'matchAndRewrite' style
canonicalization patterns for ops that don't need the full power of
RewritePatterns.  Using this style, you can implement a static method
with a signature like:

```
LogicalResult AssertOp::canonicalize(AssertOp op, PatternRewriter &rewriter) {
  return success();
}
```

instead of dealing with defining RewritePattern subclasses.  This also
adopts this for a few canonicalization patterns in the std dialect to
show how it works.

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




More information about the All-commits mailing list