diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-10-30 16:32:31 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-10-30 16:32:31 +0000 |
commit | 6f36637be032fb300c4711fcd6cac2a5a53f52f8 (patch) | |
tree | 3da5d0726fce3a3ba2062206f0bdeb6ecf89009d /llvm/lib/Target/TargetMachine.cpp | |
parent | f93591b0bef310deaf19c852c2856b288157bb42 (diff) | |
download | bcm5719-llvm-6f36637be032fb300c4711fcd6cac2a5a53f52f8.tar.gz bcm5719-llvm-6f36637be032fb300c4711fcd6cac2a5a53f52f8.zip |
Move isDSOLocal check and add a comment.
llvm-svn: 316920
Diffstat (limited to 'llvm/lib/Target/TargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/TargetMachine.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index 1b05e6ce9f4..5dcb89477a3 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -114,6 +114,17 @@ static TLSModel::Model getSelectedTLSModel(const GlobalValue *GV) { bool TargetMachine::shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const { + // If the IR producer 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 various IR producers 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 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module &M, GV->hasExternalWeakLinkage()) return false; - if (GV && (GV->hasLocalLinkage() || !GV->hasDefaultVisibility() || - GV->isDSOLocal())) + if (GV && (GV->hasLocalLinkage() || !GV->hasDefaultVisibility())) return true; if (TT.isOSBinFormatMachO()) { |