[all-commits] [llvm/llvm-project] f809eb: [mlir] Argument and result attribute handling duri...

Tobias Gysi via All-commits all-commits at lists.llvm.org
Wed Mar 22 01:08:48 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f809eb4db2d14a5a529f9f440b849b7489292976
  Author: Tobias Gysi <tobias.gysi at nextsilicon.com>
  Date:   2023-03-22 (Wed, 22 Mar 2023)

  Changed paths:
    M mlir/docs/Interfaces.md
    M mlir/docs/Tutorials/Toy/Ch-4.md
    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/MLProgram/IR/MLProgramOps.td
    M mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
    M mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
    M mlir/include/mlir/Interfaces/CallInterfaces.td
    M mlir/include/mlir/Transforms/InliningUtils.h
    M mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
    M mlir/lib/Transforms/Utils/InliningUtils.cpp
    M mlir/test/Transforms/inlining.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td

  Log Message:
  [mlir] Argument and result attribute handling during inlining.

The revision adds the handleArgument and handleResult handlers that
allow users of the inlining interface to implement argument and result
conversions that take argument and result attributes into account. The
motivating use cases for this revision are taken from the LLVM dialect
inliner, which has to copy arguments that are marked as byval and that
also has to consider zeroext / signext when converting integers.

All type conversions are currently handled by the
materializeCallConversion hook. It runs before isLegalToInline and
supports only the introduction of a single cast operation since it may
have to rollback. The new handlers run shortly before and after
inlining and cannot fail. As a result, they can introduce more complex
ir such as copying a struct argument. At the moment, the new hooks
cannot be used to perform type conversions since all type conversions
have to be done using the materializeCallConversion. A follow up
revision will either relax this constraint or drop
materializeCallConversion in favor of the new and more flexible

The revision also extends the CallableOpInterface to provide access
to the argument and result attributes if available.

Reviewed By: rriddle, Dinistro

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

More information about the All-commits mailing list