[all-commits] [llvm/llvm-project] 359164: [mlir][OpBuilder] Remove the vtable from OpBuilder...

River Riddle via All-commits all-commits at lists.llvm.org
Thu Apr 30 21:32:46 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 359164f810282035b55e7b8bb7bbecb2ed0175d0
      https://github.com/llvm/llvm-project/commit/359164f810282035b55e7b8bb7bbecb2ed0175d0
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2020-04-30 (Thu, 30 Apr 2020)

  Changed paths:
    M mlir/include/mlir/IR/Builders.h
    M mlir/include/mlir/IR/PatternMatch.h
    M mlir/include/mlir/Transforms/DialectConversion.h
    M mlir/lib/IR/Builders.cpp
    M mlir/lib/Transforms/DialectConversion.cpp
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp

  Log Message:
  -----------
  [mlir][OpBuilder] Remove the vtable from OpBuilder in favor of using the listener pattern

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.

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




More information about the All-commits mailing list