[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
Thu May 25 19:43:29 PDT 2017
davide created this revision.
Herald added subscribers: inglorion, mehdi_amini.
https://reviews.llvm.org/D33582
Files:
lib/LTO/LTO.cpp
Index: lib/LTO/LTO.cpp
===================================================================
--- lib/LTO/LTO.cpp
+++ 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.100356.patch
Type: text/x-patch
Size: 997 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/18272c5b/attachment.bin>
More information about the llvm-commits
mailing list