Allow inline of all pure ops from the LLVM dialect.
authorIngo Müller <ingomueller@google.com>
Wed, 14 Dec 2022 15:16:06 +0000 (15:16 +0000)
committerIngo Müller <ingomueller@google.com>
Wed, 14 Dec 2022 15:18:37 +0000 (15:18 +0000)
commit3a43e68ed1cbd96bc70359f0d9dced517195ae9c
tree71becf173ba5c418ea9a91f08b4f8272fec81878
parent15a6e3c636977dc962a415c067182e6d57242116
Allow inline of all pure ops from the LLVM dialect.

This allows to inline regions containing pure LLVM ops into their call
sites. (Note that this is not related to inlining of llvm.func but to
any the inlining of any Callable.) For now, we only allow the inlining
of Pure ops to be conservative but other ops may be considered inlinable
in the future.

Testing for purity of ops requires the C++ equivalent of the Pure trait
from SideEffectInterfaces.td, which this patch also provide. Its
implementation calls the C++ equivalents of the two traits that the Pure
trait is based on and, thus, has to be kept with the tablegen trait.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D139187
mlir/include/mlir/Interfaces/SideEffectInterfaces.h
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Interfaces/SideEffectInterfaces.cpp
mlir/test/Dialect/LLVMIR/inlining.mlir [new file with mode: 0644]