[all-commits] [llvm/llvm-project] d790a2: [mlir] Add getArgOperandsMutable method to CallOpI...

Martin Erhart via All-commits all-commits at lists.llvm.org
Wed Aug 2 01:35:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d790a217a746ff63190d30669674fce1bc0a4723
      https://github.com/llvm/llvm-project/commit/d790a217a746ff63190d30669674fce1bc0a4723
  Author: Martin Erhart <merhart at google.com>
  Date:   2023-08-02 (Wed, 02 Aug 2023)

  Changed paths:
    M flang/include/flang/Optimizer/Dialect/FIROps.td
    M mlir/examples/toy/Ch4/mlir/Dialect.cpp
    M mlir/examples/toy/Ch5/mlir/Dialect.cpp
    M mlir/examples/toy/Ch6/mlir/Dialect.cpp
    M mlir/examples/toy/Ch7/mlir/Dialect.cpp
    M mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
    M mlir/include/mlir/Dialect/Func/IR/FuncOps.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
    M mlir/include/mlir/Interfaces/CallInterfaces.td
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
    M mlir/test/lib/Dialect/Test/TestDialect.cpp

  Log Message:
  -----------
  [mlir] Add getArgOperandsMutable method to CallOpInterface

Add a method to the CallOpInterface to get a mutable operand range over
the function arguments.  This allows to add, remove, or change the type
of call arguments in a generic manner without having to assume that the
argument operand range is at the end of the operand list, or having to
type switch on all supported concrete operation kinds.

Alternatively, a new OpInterface could be added which inherits from
CallOpInterface and appends it with the mutable variants of the base
interface.

There will be two users of this new function in the beginning:
(1) A few passes in the Arc dialect in CIRCT already use a downstream
implementation of the alternative case mentioned above: https://github.com/llvm/circt/blob/main/include/circt/Dialect/Arc/ArcInterfaces.td#L15
(2) The BufferDeallocation pass will be modified to be able to pass
ownership of memrefs to called private functions if the caller does not
need the memref anymore by appending the function argument list with a
boolean value per memref, thus enabling earlier deallocation of the
memref which can lead to lower peak memory usage.

Reviewed By: ftynse

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




More information about the All-commits mailing list