[PATCH] D33727: [GlobalMerge] Don't merge globals that may be preempted
John Brawn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 2 03:24:35 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304537: [GlobalMerge] Don't merge globals that may be preempted (authored by john.brawn).
Changed prior to commit:
https://reviews.llvm.org/D33727?vs=100876&id=101180#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33727
Files:
llvm/trunk/lib/CodeGen/GlobalMerge.cpp
llvm/trunk/test/CodeGen/ARM/global-merge-external.ll
Index: llvm/trunk/test/CodeGen/ARM/global-merge-external.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/global-merge-external.ll
+++ llvm/trunk/test/CodeGen/ARM/global-merge-external.ll
@@ -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
Index: llvm/trunk/lib/CodeGen/GlobalMerge.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/GlobalMerge.cpp
+++ llvm/trunk/lib/CodeGen/GlobalMerge.cpp
@@ -556,6 +556,10 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33727.101180.patch
Type: text/x-patch
Size: 1392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170602/fdf11ee8/attachment.bin>
More information about the llvm-commits
mailing list