This can raise problems when internalised symbol is in comdat, while another member of comdat is exported. Such case is handled by internalize pass which is invoked later.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
I think this change is generally good but sorry I am not quite familiar with the semantics of comdat. Can you explain in more detail why that can be a problem to internalize that in promote?
Comment Actions
From https://llvm.org/docs/LangRef.html#comdats :
Comdats have a name which represents the COMDAT key. All global objects that specify this key will only end up in the final object file if the linker chooses that key over some other key
To enforce this LLVM internalize pass doesn't internalize entire COMDAT group if any of its members should be preserved (see shouldPreserveGV). At the moment we can internalize global
in llvm::thinLTOResolvePrevailingInModule without looking at other COMDAT group members and break this guarantee
Comment Actions
Yep, just had a chance to look. Suggest adding a comment above the new check that internalization is done separately since the internalization code contains the necessary correctness checks.