From b8c075e89ee755be34f661f2f10ce0ed8126406e Mon Sep 17 00:00:00 2001 From: Guojin He 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 170662f5b276d..9553d50e75f98 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 079aa6f90bf11..cd9b7d9ffb138 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 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 --- 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 cd9b7d9ffb138..1cf10631ba0d6 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 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 1cf10631ba0d6..df80c3cccf3c1 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 }