Skip to content
Snippets Groups Projects
Commit fcf5f77b authored by Tom Stellard's avatar Tom Stellard
Browse files

Merging r304537:

------------------------------------------------------------------------
r304537 | john.brawn | 2017-06-02 06:24:14 -0400 (Fri, 02 Jun 2017) | 9 lines

[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: 305187
parent 162fcbc8
No related branches found
No related tags found
No related merge requests found
......@@ -559,6 +559,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;
......
......@@ -2,6 +2,7 @@
; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge -global-merge-on-external=true | FileCheck %s --check-prefix=CHECK-MERGE
; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge -global-merge-on-external=false | FileCheck %s --check-prefix=CHECK-NO-MERGE
; RUN: llc < %s -mtriple=arm-macho -arm-global-merge | FileCheck %s --check-prefix=CHECK-NO-MERGE
; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge -relocation-model=pic | FileCheck %s --check-prefix=CHECK-NO-MERGE
@x = global i32 0, align 4
@y = global i32 0, align 4
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment