[PATCH] D33582: [lib/LTO] Don't reinvent the code for switching linkage
Davide Italiano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 14:56:38 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304040: [lib/LTO] Don't reinvent the code for switching linkage. (authored by davide).
Changed prior to commit:
https://reviews.llvm.org/D33582?vs=100356&id=100479#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33582
Files:
llvm/trunk/lib/LTO/LTO.cpp
Index: llvm/trunk/lib/LTO/LTO.cpp
===================================================================
--- llvm/trunk/lib/LTO/LTO.cpp
+++ llvm/trunk/lib/LTO/LTO.cpp
@@ -542,16 +542,10 @@
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()) &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33582.100479.patch
Type: text/x-patch
Size: 1030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/18be63cf/attachment.bin>
More information about the llvm-commits
mailing list