This is an archive of the discontinued LLVM Phabricator instance.

[mlir][FuncToLLVM] Drop llvm.linkage attribute
ClosedPublic

Authored by Dinistro on Jan 18 2023, 2:54 AM.

Details

Summary

This commit ensures that all functions produced by FuncToLLVM drop the
llvm.linkage attribute. Furthermore, it adds a small test that checks if
the readnone attribute is preserved.

Diff Detail

Event Timeline

Dinistro created this revision.Jan 18 2023, 2:54 AM
Herald added a project: Restricted Project. · View Herald Transcript
Dinistro requested review of this revision.Jan 18 2023, 2:54 AM
Dinistro updated this revision to Diff 490093.Jan 18 2023, 3:00 AM

Small comment change

gysit accepted this revision.Jan 18 2023, 4:26 AM
gysit added inline comments.
mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
67

ultra nit: Drop -> Drops.

I am not sure about the second half of the comment ("or are attached to the function manually". In general the function seems to copy all manually set attributes except for linkageAttrName? Shouldn't we just drop this second half of the sentence?

mlir/test/Conversion/FuncToLLVM/emit-c-wrappers-for-external-callers.mlir
76

nit: what about calling the function "drop_default_linkage"? Then it is more obvious why the linkage is not printed?

This revision is now accepted and ready to land.Jan 18 2023, 4:26 AM
Dinistro updated this revision to Diff 490114.Jan 18 2023, 5:25 AM
Dinistro marked 2 inline comments as done.

Addressed review comments

Dinistro added inline comments.Jan 18 2023, 5:26 AM
mlir/test/Conversion/FuncToLLVM/emit-c-wrappers-for-external-callers.mlir
76

This does not just drop the external linkage but all linkage attributes. I changed the other test to use weak linkage to demonstrate that this influences the signature but no longer appears as an attribute.

This revision was automatically updated to reflect the committed changes.