Skip to content

[MLIR][LLVM] LLVM import should use is isDSOLocal instead of hasLocalLinkage to set dso_local attribute #124822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mlir/lib/Target/LLVMIR/ModuleImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions mlir/test/Target/LLVMIR/Import/function-attributes.ll
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ define internal spir_func void @spir_func_internal() {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Can you move this into a separate split, i.e., can you add ; // ----- above the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. just made its own split

; // -----

; 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<other = none, argMem = none, inaccessibleMem = none>}
; CHECK: llvm.return
Expand Down