[all-commits] [llvm/llvm-project] bb1d97: [mlir][flang] use OpBuilder& instead of Builder* i...

ftynse via All-commits all-commits at lists.llvm.org
Tue Apr 28 01:42:29 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bb1d976febf25e272a9f7ae51974207232481e3e
      https://github.com/llvm/llvm-project/commit/bb1d976febf25e272a9f7ae51974207232481e3e
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-04-28 (Tue, 28 Apr 2020)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/FIROps.h
    M flang/include/flang/Optimizer/Dialect/FIROps.td
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M mlir/docs/DeclarativeRewrites.md
    M mlir/docs/OpDefinitions.md
    M mlir/docs/Tutorials/Toy/Ch-2.md
    M mlir/examples/toy/Ch2/include/toy/Ops.td
    M mlir/examples/toy/Ch2/mlir/Dialect.cpp
    M mlir/examples/toy/Ch3/include/toy/Ops.td
    M mlir/examples/toy/Ch3/mlir/Dialect.cpp
    M mlir/examples/toy/Ch4/include/toy/Ops.td
    M mlir/examples/toy/Ch4/mlir/Dialect.cpp
    M mlir/examples/toy/Ch5/include/toy/Ops.td
    M mlir/examples/toy/Ch5/mlir/Dialect.cpp
    M mlir/examples/toy/Ch6/include/toy/Ops.td
    M mlir/examples/toy/Ch6/mlir/Dialect.cpp
    M mlir/examples/toy/Ch7/include/toy/Ops.td
    M mlir/examples/toy/Ch7/mlir/Dialect.cpp
    M mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
    M mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
    M mlir/include/mlir/Dialect/GPU/GPUOps.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
    M mlir/include/mlir/Dialect/LoopOps/LoopOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVAtomicOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVCompositeOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVControlFlowOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVLogicalOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVNonUniformOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVOps.td
    M mlir/include/mlir/Dialect/SPIRV/SPIRVStructureOps.td
    M mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.h
    M mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
    M mlir/include/mlir/Dialect/Vector/VectorOps.td
    M mlir/include/mlir/IR/Builders.h
    M mlir/include/mlir/IR/Function.h
    M mlir/include/mlir/IR/Module.h
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/IR/OpDefinition.h
    M mlir/include/mlir/IR/PatternMatch.h
    M mlir/include/mlir/Transforms/FoldUtils.h
    M mlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    M mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
    M mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    M mlir/lib/Dialect/LoopOps/LoopOps.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVLowering.cpp
    M mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
    M mlir/lib/Dialect/SPIRV/Serialization/Deserializer.cpp
    M mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp
    M mlir/lib/Dialect/StandardOps/IR/Ops.cpp
    M mlir/lib/Dialect/Vector/VectorOps.cpp
    M mlir/lib/IR/Function.cpp
    M mlir/lib/IR/Module.cpp
    M mlir/lib/IR/Operation.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp
    M mlir/test/mlir-tblgen/op-attribute.td
    M mlir/test/mlir-tblgen/op-decl.td
    M mlir/test/mlir-tblgen/op-result.td
    M mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-gen.cpp
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
    M mlir/unittests/Dialect/SPIRV/SerializationTest.cpp

  Log Message:
  -----------
  [mlir][flang] use OpBuilder& instead of Builder* in <Op>::build methods

As we start defining more complex Ops, we increasingly see the need for
Ops-with-regions to be able to construct Ops within their regions in
their ::build methods. However, these methods only have access to
Builder, and not OpBuilder. Creating a local instance of OpBuilder
inside ::build and using it fails to trigger the operation creation
hooks in derived builders (e.g., ConversionPatternRewriter). In this
case, we risk breaking the logic of the derived builder. At the same
time, OpBuilder::create, which is by far the largest user of ::build
already passes "this" as the first argument, so an OpBuilder instance is
already available.

Update all ::build methods in all Ops in MLIR and Flang to take
"OpBuilder &" instead of "Builder *". Note the change from pointer and
to reference to comply with the common style in MLIR, this also ensures
all other users must change their ::build methods.

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




More information about the All-commits mailing list