[PATCH] D42127: [GlobalMerge] Don't merge dllexport globals
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 18 13:37:07 PST 2018
mstorsjo updated this revision to Diff 130490.
mstorsjo retitled this revision from "[ARM] Don't merge global externals for windows" to "[GlobalMerge] Don't merge dllexport globals".
mstorsjo edited the summary of this revision.
mstorsjo added a comment.
Changed to explicitly check for the dllexport attribute.
https://reviews.llvm.org/D42127
Files:
lib/CodeGen/GlobalMerge.cpp
test/CodeGen/ARM/global-merge-dllexport.ll
Index: test/CodeGen/ARM/global-merge-dllexport.ll
===================================================================
--- /dev/null
+++ 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: lib/CodeGen/GlobalMerge.cpp
===================================================================
--- lib/CodeGen/GlobalMerge.cpp
+++ 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.130490.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180118/90731f84/attachment.bin>
More information about the llvm-commits
mailing list