This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add COMDAT to global variables where needed
ClosedPublic

Authored by DavidTruby on Jun 26 2023, 7:07 AM.

Details

Summary

On platforms which support COMDAT sections we should use them when
linkonce or linkonce_odr linkage is requested. This is required on
Windows (PE/COFF) and provides better behaviour than weak symbols on
ELF-based platforms.

This patch also reverts string literals to use linkonce instead of
internal linkage now that comdats are supported.

Diff Detail

Event Timeline

DavidTruby created this revision.Jun 26 2023, 7:07 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 26 2023, 7:07 AM
DavidTruby requested review of this revision.Jun 26 2023, 7:07 AM

Forgot to remove TODO comment saying we can change back to linkonce

DavidTruby added inline comments.
flang/lib/Optimizer/CodeGen/CodeGen.cpp
49

I have no idea why my text editor does this and I can't make it stop....

Remove unnecessary headers added by editor...

tblah accepted this revision.Jun 26 2023, 9:38 AM

LGTM, thanks!

This revision is now accepted and ready to land.Jun 26 2023, 9:38 AM
jeanPerier accepted this revision.Jun 26 2023, 11:55 PM

Looks good, thanks for the addition of COMDAT support in MLIR.

This revision was automatically updated to reflect the committed changes.