[PATCH] D42127: [GlobalMerge] Don't merge dllexport globals
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 22:41:43 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323307: [GlobalMerge] Don't merge dllexport globals (authored by mstorsjo, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42127?vs=130562&id=131202#toc
Repository:
rL LLVM
https://reviews.llvm.org/D42127
Files:
llvm/trunk/lib/CodeGen/GlobalMerge.cpp
llvm/trunk/test/CodeGen/ARM/global-merge-dllexport.ll
llvm/trunk/test/CodeGen/ARM/global-merge-external.ll
Index: llvm/trunk/test/CodeGen/ARM/global-merge-dllexport.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/global-merge-dllexport.ll
+++ llvm/trunk/test/CodeGen/ARM/global-merge-dllexport.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -mtriple=thumbv7-win32 -arm-global-merge | FileCheck %s
+
+ at x = global i32 0, align 4
+ at y = dllexport global i32 0, align 4
+
+define void @f1(i32 %a1, i32 %a2) {
+; CHECK: f1:
+; CHECK: movw [[REG1:r[0-9]+]], :lower16:x
+; CHECK: movt [[REG1]], :upper16:x
+ store i32 %a1, i32* @x, align 4
+ store i32 %a2, i32* @y, align 4
+ ret void
+}
+
+; CHECK-NOT: .L_MergedGlobals
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
@@ -3,6 +3,7 @@
; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge -global-merge-on-external=false | FileCheck %s --check-prefixes=CHECK,CHECK-NO-MERGE
; RUN: llc < %s -mtriple=arm-macho -arm-global-merge | FileCheck %s --check-prefixes=CHECK,CHECK-NO-MERGE
; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge -relocation-model=pic | FileCheck %s --check-prefixes=CHECK,CHECK-NO-MERGE
+; RUN: llc < %s -mtriple=thumbv7-win32 -arm-global-merge | FileCheck %s --check-prefixes=CHECK-WIN32
@x = global i32 0, align 4
@y = global i32 0, align 4
@@ -14,6 +15,9 @@
;CHECK: [[LABEL1]]:
;CHECK-MERGE: .long .L_MergedGlobals
;CHECK-NO-MERGE: .long {{_?x}}
+;CHECK-WIN32: f1:
+;CHECK-WIN32: movw [[REG1:r[0-9]+]], :lower16:.L_MergedGlobals
+;CHECK-WIN32: movt [[REG1]], :upper16:.L_MergedGlobals
store i32 %a1, i32* @x, align 4
store i32 %a2, i32* @y, align 4
ret void
@@ -25,6 +29,9 @@
;CHECK: [[LABEL2]]:
;CHECK-MERGE: .long .L_MergedGlobals
;CHECK-NO-MERGE: .long {{_?y}}
+;CHECK-WIN32: g1:
+;CHECK-WIN32: movw [[REG2:r[0-9]+]], :lower16:.L_MergedGlobals
+;CHECK-WIN32: movt [[REG2]], :upper16:.L_MergedGlobals
store i32 %a1, i32* @y, align 4
store i32 %a2, i32* @z, align 4
ret void
@@ -35,6 +42,7 @@
;CHECK-MERGE: .type .L_MergedGlobals,%object
;CHECK-MERGE: .local .L_MergedGlobals
;CHECK-MERGE: .comm .L_MergedGlobals,12,4
+;CHECK-WIN32: .lcomm .L_MergedGlobals,12,4
;CHECK-MERGE: .globl x
;CHECK-MERGE: x = .L_MergedGlobals
@@ -45,3 +53,10 @@
;CHECK-MERGE: .globl z
;CHECK-MERGE: z = .L_MergedGlobals+8
;CHECK-MERGE: .size z, 4
+
+;CHECK-WIN32: .globl x
+;CHECK-WIN32: x = .L_MergedGlobals
+;CHECK-WIN32: .globl y
+;CHECK-WIN32: y = .L_MergedGlobals+4
+;CHECK-WIN32: .globl z
+;CHECK-WIN32: z = .L_MergedGlobals+8
Index: llvm/trunk/lib/CodeGen/GlobalMerge.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/GlobalMerge.cpp
+++ llvm/trunk/lib/CodeGen/GlobalMerge.cpp
@@ -577,7 +577,8 @@
for (auto &GV : M.globals()) {
// Merge is safe for "normal" internal or external globals only
if (GV.isDeclaration() || GV.isThreadLocal() ||
- GV.hasSection() || GV.hasImplicitSection())
+ GV.hasSection() || GV.hasImplicitSection() ||
+ GV.hasDLLExportStorageClass())
continue;
// It's not safe to merge globals that may be preempted
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42127.131202.patch
Type: text/x-patch
Size: 3368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180124/49693734/attachment.bin>
More information about the llvm-commits
mailing list