[Mlir-commits] [mlir] [MLIR][LLVM] LLVM import should use is isDSOLocal instead of hasLocalLinkage to set dso_local attribute (PR #124822)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jan 29 06:39:39 PST 2025
https://github.com/ghehg updated https://github.com/llvm/llvm-project/pull/124822
>From b8c075e89ee755be34f661f2f10ce0ed8126406e Mon Sep 17 00:00:00 2001
From: Guojin He <he.guojin at gmail.com>
Date: Tue, 28 Jan 2025 14:06:22 -0500
Subject: [PATCH 1/3] [MLIR] should use dso_local
---
mlir/lib/Target/LLVMIR/ModuleImport.cpp | 2 +-
mlir/test/Target/LLVMIR/Import/function-attributes.ll | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/mlir/lib/Target/LLVMIR/ModuleImport.cpp b/mlir/lib/Target/LLVMIR/ModuleImport.cpp
index 170662f5b276d4..9553d50e75f981 100644
--- a/mlir/lib/Target/LLVMIR/ModuleImport.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleImport.cpp
@@ -2128,7 +2128,7 @@ LogicalResult ModuleImport::processFunction(llvm::Function *func) {
iface.isConvertibleIntrinsic(func->getIntrinsicID()))
return success();
- bool dsoLocal = func->hasLocalLinkage();
+ bool dsoLocal = func->isDSOLocal();
CConv cconv = convertCConvFromLLVM(func->getCallingConv());
// Insert the function at the end of the module.
diff --git a/mlir/test/Target/LLVMIR/Import/function-attributes.ll b/mlir/test/Target/LLVMIR/Import/function-attributes.ll
index 079aa6f90bf11d..cd9b7d9ffb138b 100644
--- a/mlir/test/Target/LLVMIR/Import/function-attributes.ll
+++ b/mlir/test/Target/LLVMIR/Import/function-attributes.ll
@@ -10,6 +10,12 @@ define internal spir_func void @spir_func_internal() {
ret void
}
+; Ensure that we have dso_local;
+; CHECK : llvm.func @dsolocal_func() attributes{dso_local}
+define dso_local void @dsolocal_func() {
+ ret void
+}
+
; // -----
; CHECK-LABEL: @func_readnone
>From 798e1bce7028ef1446970492173f20b11f94499a Mon Sep 17 00:00:00 2001
From: Guojin <he.guojin at gmail.com>
Date: Wed, 29 Jan 2025 08:19:01 -0500
Subject: [PATCH 2/3] Update
mlir/test/Target/LLVMIR/Import/function-attributes.ll
fixed typos in the test
Co-authored-by: Tobias Gysi <tobias.gysi at nextsilicon.com>
---
mlir/test/Target/LLVMIR/Import/function-attributes.ll | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/mlir/test/Target/LLVMIR/Import/function-attributes.ll b/mlir/test/Target/LLVMIR/Import/function-attributes.ll
index cd9b7d9ffb138b..1cf10631ba0d6b 100644
--- a/mlir/test/Target/LLVMIR/Import/function-attributes.ll
+++ b/mlir/test/Target/LLVMIR/Import/function-attributes.ll
@@ -10,8 +10,9 @@ define internal spir_func void @spir_func_internal() {
ret void
}
-; Ensure that we have dso_local;
-; CHECK : llvm.func @dsolocal_func() attributes{dso_local}
+; Ensure that we have dso_local.
+; CHECK: llvm.func @dsolocal_func()
+; CHECK-SAME: attributes{dso_local}
define dso_local void @dsolocal_func() {
ret void
}
>From 88ec5f1e8dfc029ff8d175be76e6e7df57390426 Mon Sep 17 00:00:00 2001
From: Guojin He <he.guojin at gmail.com>
Date: Wed, 29 Jan 2025 09:38:32 -0500
Subject: [PATCH 3/3] make added test split
---
mlir/test/Target/LLVMIR/Import/function-attributes.ll | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mlir/test/Target/LLVMIR/Import/function-attributes.ll b/mlir/test/Target/LLVMIR/Import/function-attributes.ll
index 1cf10631ba0d6b..df80c3cccf3c12 100644
--- a/mlir/test/Target/LLVMIR/Import/function-attributes.ll
+++ b/mlir/test/Target/LLVMIR/Import/function-attributes.ll
@@ -10,9 +10,11 @@ define internal spir_func void @spir_func_internal() {
ret void
}
+; // -----
+
; Ensure that we have dso_local.
; CHECK: llvm.func @dsolocal_func()
-; CHECK-SAME: attributes{dso_local}
+; CHECK-SAME: attributes {dso_local}
define dso_local void @dsolocal_func() {
ret void
}
More information about the Mlir-commits
mailing list