[llvm] r304040 - [lib/LTO] Don't reinvent the code for switching linkage.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 14:56:14 PDT 2017
Author: davide
Date: Fri May 26 16:56:14 2017
New Revision: 304040
URL: http://llvm.org/viewvc/llvm-project?rev=304040&view=rev
Log:
[lib/LTO] Don't reinvent the code for switching linkage.
Differential Revision: https://reviews.llvm.org/D33582
Modified:
llvm/trunk/lib/LTO/LTO.cpp
Modified: llvm/trunk/lib/LTO/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTO.cpp?rev=304040&r1=304039&r2=304040&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTO.cpp (original)
+++ llvm/trunk/lib/LTO/LTO.cpp Fri May 26 16:56:14 2017
@@ -542,16 +542,10 @@ Error LTO::addRegularLTO(BitcodeModule B
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()) &&
More information about the llvm-commits
mailing list