<div dir="ltr"><div dir="ltr">Hello Michael,<br><br>This commit broke test for the builder:<br><a href="http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/3704">http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/3704</a><br>. . . <br>Failing Tests (1):<br> LLVM :: CodeGen/AArch64/global-merge-hidden-minsize.ll<br><br>Please have a look ASAP?<br><br>Thanks</div><div dir="ltr"><br></div><div>Galina</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 28, 2020 at 1:26 PM Eli Friedman via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Michael Spang<br>
Date: 2020-01-28T13:26:18-08:00<br>
New Revision: a2fb2c0ddca14c133f24d08af4a78b6a3d612ec6<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/a2fb2c0ddca14c133f24d08af4a78b6a3d612ec6" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/a2fb2c0ddca14c133f24d08af4a78b6a3d612ec6</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/a2fb2c0ddca14c133f24d08af4a78b6a3d612ec6.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/a2fb2c0ddca14c133f24d08af4a78b6a3d612ec6.diff</a><br>
<br>
LOG: [GlobalMerge] Preserve symbol visibility when merging globals<br>
<br>
Symbols created for merged external global variables have default<br>
visibility. This can break programs when compiling with -Oz<br>
-fvisibility=hidden as symbols that should be hidden will be exported at<br>
link time.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D73235" rel="noreferrer" target="_blank">https://reviews.llvm.org/D73235</a><br>
<br>
Added: <br>
llvm/test/CodeGen/AArch64/global-merge-hidden-minsize.ll<br>
<br>
Modified: <br>
llvm/lib/CodeGen/GlobalMerge.cpp<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp<br>
index 5870e20d4227..6e5593abb43e 100644<br>
--- a/llvm/lib/CodeGen/GlobalMerge.cpp<br>
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp<br>
@@ -524,6 +524,7 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals,<br>
for (ssize_t k = i, idx = 0; k != j; k = GlobalSet.find_next(k), ++idx) {<br>
GlobalValue::LinkageTypes Linkage = Globals[k]->getLinkage();<br>
std::string Name = Globals[k]->getName();<br>
+ GlobalValue::VisibilityTypes Visibility = Globals[k]->getVisibility();<br>
GlobalValue::DLLStorageClassTypes DLLStorage =<br>
Globals[k]->getDLLStorageClass();<br>
<br>
@@ -549,6 +550,7 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals,<br>
if (Linkage != GlobalValue::InternalLinkage || !IsMachO) {<br>
GlobalAlias *GA = GlobalAlias::create(Tys[StructIdxs[idx]], AddrSpace,<br>
Linkage, Name, GEP, &M);<br>
+ GA->setVisibility(Visibility);<br>
GA->setDLLStorageClass(DLLStorage);<br>
}<br>
<br>
<br>
diff --git a/llvm/test/CodeGen/AArch64/global-merge-hidden-minsize.ll b/llvm/test/CodeGen/AArch64/global-merge-hidden-minsize.ll<br>
new file mode 100644<br>
index 000000000000..25241ad2af8a<br>
--- /dev/null<br>
+++ b/llvm/test/CodeGen/AArch64/global-merge-hidden-minsize.ll<br>
@@ -0,0 +1,26 @@<br>
+; RUN: llc %s -mtriple=arm-none-linux-gnu -o - | FileCheck %s<br>
+; RUN: llc %s -mtriple=aarch64-none-linux-gnu -o - | FileCheck %s<br>
+<br>
+@x = hidden global i32 0, align 4<br>
+@y = hidden global i32 0, align 4<br>
+<br>
+define hidden void @f() #0 {<br>
+ store i32 0, i32* @x, align 4<br>
+ store i32 0, i32* @y, align 4<br>
+ ret void<br>
+}<br>
+<br>
+attributes #0 = { minsize optsize }<br>
+<br>
+; CHECK: .local .L_MergedGlobals<br>
+; CHECK: .comm .L_MergedGlobals,8,4<br>
+<br>
+; CHECK: .globl x<br>
+; CHECK: .hidden x<br>
+; CHECK: .set x, .L_MergedGlobals<br>
+; CHECK: .size x, 4<br>
+<br>
+; CHECK: .globl y<br>
+; CHECK: .hidden y<br>
+; CHECK: .set y, .L_MergedGlobals+4<br>
+; CHECK: .size y, 4<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>