[mlir] Fix --convert-func-to-llvm=emit-c-wrappers argument and result attribute handling
authorSam Carroll <sam.carroll@lmns.com>
Tue, 15 Mar 2022 14:22:31 +0000 (15:22 +0100)
committerAlex Zinenko <zinenko@google.com>
Tue, 15 Mar 2022 14:29:43 +0000 (15:29 +0100)
commit541d89b02c10997477f9109945b1d700d6a78c65
tree2ed3b23587fd993caaf6adaf677bf3702ee5c942
parent64af346b185ab3c3c34e145181717350c304b05a
[mlir] Fix --convert-func-to-llvm=emit-c-wrappers argument and result attribute handling

When using `--convert-func-to-llvm=emit-c-wrappers` the attribute arguments of the wrapper would not be created correctly in some cases.
This patch fixes that and introduces a set of tests for (hopefully) all corner cases.

See https://github.com/llvm/llvm-project/issues/53503

Author: Sam Carroll <sam.carroll@lmns.com>
Co-Author: Laszlo Kindrat <laszlo.kindrat@lmns.com>

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D119895
mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/test/Conversion/StandardToLLVM/emit-c-wrappers-for-external-callers.mlir [new file with mode: 0644]
mlir/test/Conversion/StandardToLLVM/emit-c-wrappers-for-external-functions.mlir [new file with mode: 0644]
mlir/test/Dialect/LLVMIR/func.mlir
mlir/test/Dialect/LLVMIR/invalid.mlir