Skip to content
This repository has been archived by the owner on Dec 20, 2019. It is now read-only.

Commit

Permalink
[LDC] PGO: Avoid COMDATs with private linkage (fixing PGO for Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Sep 20, 2019
1 parent 83aee82 commit f21cbc0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ProfileData/InstrProf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,14 @@ GlobalVariable *createPGOFuncNameVar(Module &M,
Linkage = GlobalValue::LinkOnceAnyLinkage;
else if (Linkage == GlobalValue::AvailableExternallyLinkage)
Linkage = GlobalValue::LinkOnceODRLinkage;
/* LDC: use `internal` instead of `private` linkage (still local, but allows
for COMDATs, and is required for Windows)
else if (Linkage == GlobalValue::InternalLinkage ||
Linkage == GlobalValue::ExternalLinkage)
Linkage = GlobalValue::PrivateLinkage;
*/
else if (Linkage == GlobalValue::ExternalLinkage)
Linkage = GlobalValue::InternalLinkage;

auto *Value =
ConstantDataArray::getString(M.getContext(), PGOFuncName, false);
Expand Down

0 comments on commit f21cbc0

Please sign in to comment.