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..df80c3cccf3c1 100644 --- a/mlir/test/Target/LLVMIR/Import/function-attributes.ll +++ b/mlir/test/Target/LLVMIR/Import/function-attributes.ll @@ -12,6 +12,15 @@ define internal spir_func void @spir_func_internal() { ; // ----- +; Ensure that we have dso_local. +; CHECK: llvm.func @dsolocal_func() +; CHECK-SAME: attributes {dso_local} +define dso_local void @dsolocal_func() { + ret void +} + +; // ----- + ; CHECK-LABEL: @func_readnone ; CHECK-SAME: attributes {memory_effects = #llvm.memory_effects} ; CHECK: llvm.return