[PATCH] D79206: [mlir][OpBuilder] Remove the vtable from OpBuilder in favor of using the listener pattern

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 14:32:56 PDT 2020


rriddle created this revision.
rriddle added reviewers: mehdi_amini, jpienaar, ftynse.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen.
Herald added a reviewer: nicolasvasilache.
Herald added a project: LLVM.
rriddle updated this revision to Diff 261352.
rriddle added a comment.
rriddle updated this revision to Diff 261354.

Update comment to use ///


rriddle added a comment.

Rebase


The current OpBuilder has a set of virtual functions required by the fact that the PatternRewriter inherits from it for convenience. The PatternRewriter is required to know about IR mutations for correctness. This revision changes the relationship to be explicit by having users register a listener with the builder instead of using inheritance/vtables. This still requires that users properly transfer the listener when creating new builders, but has several benefits:

- More than one builder can be created during pattern rewrites(assuming that the listener is properly forwarded)
- OpBuilder no longer requires a vtable, and thus does not incur the cost when a listener isn't present.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79206

Files:
  mlir/include/mlir/IR/Builders.h
  mlir/include/mlir/IR/PatternMatch.h
  mlir/include/mlir/Transforms/DialectConversion.h
  mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
  mlir/lib/IR/Builders.cpp
  mlir/lib/Transforms/DialectConversion.cpp
  mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79206.261354.patch
Type: text/x-patch
Size: 13412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200430/951dc070/attachment.bin>


More information about the llvm-commits mailing list