[PATCH] D39390: Move isDSOLocal check and add a comment
Rafael Ávila de Espíndola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 14:32:44 PDT 2017
rafael created this revision.
https://reviews.llvm.org/D39390
Files:
lib/Target/TargetMachine.cpp
Index: lib/Target/TargetMachine.cpp
===================================================================
--- lib/Target/TargetMachine.cpp
+++ lib/Target/TargetMachine.cpp
@@ -114,6 +114,17 @@
bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
const GlobalValue *GV) const {
+ // If the front end requested that this GV be treated as dso local, obey.
+ if (GV && GV->isDSOLocal())
+ return true;
+
+ // According to the llvm language reference, we should be able to just return
+ // false in here if we have a GV, as we know it is dso_preemptable.
+ // At this point in time, the frontends have not been transitioned to always
+ // produce a dso_local when it is possible to do so. As a result we still have
+ // some pre-dso_local logic in here to improve the quality of the generated
+ // code:
+
Reloc::Model RM = getRelocationModel();
const Triple &TT = getTargetTriple();
@@ -137,8 +148,7 @@
GV->hasExternalWeakLinkage())
return false;
- if (GV && (GV->hasLocalLinkage() || !GV->hasDefaultVisibility() ||
- GV->isDSOLocal()))
+ if (GV && (GV->hasLocalLinkage() || !GV->hasDefaultVisibility()))
return true;
if (TT.isOSBinFormatMachO()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39390.120698.patch
Type: text/x-patch
Size: 1251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171027/a9036052/attachment.bin>
More information about the llvm-commits
mailing list