summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GlobalMerge.cpp
diff options
context:
space:
mode:
authorJohn Brawn <john.brawn@arm.com>2017-06-02 10:24:14 +0000
committerJohn Brawn <john.brawn@arm.com>2017-06-02 10:24:14 +0000
commit6671616cdeeb98b15c411d77d9d8c0466fab1bdb (patch)
tree994ebb1467c1060ec0c6a6cebbef09ba6e304613 /llvm/lib/CodeGen/GlobalMerge.cpp
parente7aa90987d2e4fe71ab683ebca80a01d29d4ff7b (diff)
downloadbcm5719-llvm-6671616cdeeb98b15c411d77d9d8c0466fab1bdb.tar.gz
bcm5719-llvm-6671616cdeeb98b15c411d77d9d8c0466fab1bdb.zip
[GlobalMerge] Don't merge globals that may be preempted
When a global may be preempted it needs to be accessed directly, instead of indirectly through a MergedGlobals symbol, for the preemption to work. This fixes PR33136. Differential Revision: https://reviews.llvm.org/D33727 llvm-svn: 304537
Diffstat (limited to 'llvm/lib/CodeGen/GlobalMerge.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalMerge.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp
index 23812a2a234..3603f9b7ed9 100644
--- a/llvm/lib/CodeGen/GlobalMerge.cpp
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp
@@ -556,6 +556,10 @@ bool GlobalMerge::doInitialization(Module &M) {
if (GV.isDeclaration() || GV.isThreadLocal() || GV.hasSection())
continue;
+ // It's not safe to merge globals that may be preempted
+ if (TM && !TM->shouldAssumeDSOLocal(M, &GV))
+ continue;
+
if (!(MergeExternalGlobals && GV.hasExternalLinkage()) &&
!GV.hasInternalLinkage())
continue;
OpenPOWER on IntegriCloud