1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[lib/LTO] Don't reinvent the code for switching linkage.

Differential Revision:  https://reviews.llvm.org/D33582

llvm-svn: 304040
This commit is contained in:
Davide Italiano 2017-05-26 21:56:14 +00:00
parent 4d8b3e20c7
commit afaa7cc982

View File

@ -542,16 +542,10 @@ Error LTO::addRegularLTO(BitcodeModule BM,
if (Sym.isUndefined())
continue;
Keep.push_back(GV);
switch (GV->getLinkage()) {
default:
break;
case GlobalValue::LinkOnceAnyLinkage:
GV->setLinkage(GlobalValue::WeakAnyLinkage);
break;
case GlobalValue::LinkOnceODRLinkage:
GV->setLinkage(GlobalValue::WeakODRLinkage);
break;
}
GlobalValue::LinkageTypes OriginalLinkage = GV->getLinkage();
if (GlobalValue::isLinkOnceLinkage(OriginalLinkage))
GV->setLinkage(GlobalValue::getWeakLinkage(
GlobalValue::isLinkOnceODRLinkage(OriginalLinkage)));
} else if (isa<GlobalObject>(GV) &&
(GV->hasLinkOnceODRLinkage() || GV->hasWeakODRLinkage() ||
GV->hasAvailableExternallyLinkage()) &&