[Mlir-commits] [mlir] 37c750a - [mlir:LLVM] Fix minor bug, missing cconv translation
Hendrik Greving
llvmlistbot at llvm.org
Mon Jan 16 12:19:50 PST 2023
Author: Hendrik Greving
Date: 2023-01-16T12:18:28-08:00
New Revision: 37c750a5fd13ebecf143a7c918aa981fc4ce3e3d
URL: https://github.com/llvm/llvm-project/commit/37c750a5fd13ebecf143a7c918aa981fc4ce3e3d
DIFF: https://github.com/llvm/llvm-project/commit/37c750a5fd13ebecf143a7c918aa981fc4ce3e3d.diff
LOG: [mlir:LLVM] Fix minor bug, missing cconv translation
Fixes translating the calling convention to LLVM-IR, possibly missed
by https://reviews.llvm.org/D126161, and adds a test.
Added:
Modified:
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/test/Dialect/LLVMIR/func.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index b5c1bef4d2718..33403b030744e 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -883,6 +883,7 @@ LogicalResult ModuleTranslation::convertFunctionSignatures() {
cast<llvm::FunctionType>(convertType(function.getFunctionType())));
llvm::Function *llvmFunc = cast<llvm::Function>(llvmFuncCst.getCallee());
llvmFunc->setLinkage(convertLinkageToLLVM(function.getLinkage()));
+ llvmFunc->setCallingConv(convertCConvToLLVM(function.getCConv()));
mapFunction(function.getName(), llvmFunc);
addRuntimePreemptionSpecifier(function.getDsoLocal(), llvmFunc);
diff --git a/mlir/test/Dialect/LLVMIR/func.mlir b/mlir/test/Dialect/LLVMIR/func.mlir
index 8f347598bd7cf..dedf00164a8ed 100644
--- a/mlir/test/Dialect/LLVMIR/func.mlir
+++ b/mlir/test/Dialect/LLVMIR/func.mlir
@@ -1,6 +1,7 @@
// RUN: mlir-opt -split-input-file -verify-diagnostics %s | mlir-opt | FileCheck %s
// RUN: mlir-opt -split-input-file -verify-diagnostics -mlir-print-op-generic %s | FileCheck %s --check-prefix=GENERIC
// RUN: mlir-opt -split-input-file -verify-diagnostics %s -mlir-print-debuginfo | mlir-opt -mlir-print-debuginfo | FileCheck %s --check-prefix=LOCINFO
+// RUN: mlir-translate -mlir-to-llvmir -split-input-file -verify-diagnostics %s | FileCheck %s --check-prefix=CHECK-LLVM
module {
// GENERIC: "llvm.func"
@@ -8,7 +9,7 @@ module {
// GENERIC-SAME: sym_name = "foo"
// GENERIC-SAME: () -> ()
// CHECK: llvm.func @foo()
- "llvm.func"() ({
+ "llvm.func" () ({
}) {sym_name = "foo", function_type = !llvm.func<void ()>} : () -> ()
// GENERIC: "llvm.func"
@@ -142,6 +143,11 @@ module {
llvm.return
}
+ // CHECK-LLVM: define ptx_kernel void @calling_conv
+ llvm.func ptx_kernelcc @calling_conv() {
+ llvm.return
+ }
+
// Omit the `external` linkage, which is the default, in the custom format.
// Check that it is present in the generic format using its numeric value.
//
More information about the Mlir-commits
mailing list