llvm.org GIT mirror llvm / bbd9c21
LTO: -internalize sets visibility to default Visibility is meaningless when the linkage is local. Change `-internalize` to reset the visibility to `default`. <rdar://problem/16141113> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207979 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 5 years ago
2 changed file(s) with 28 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
158158 if (!shouldInternalize(*I, ExternalNames))
159159 continue;
160160
161 I->setVisibility(GlobalValue::DefaultVisibility);
161162 I->setLinkage(GlobalValue::InternalLinkage);
162163
163164 if (ExternalNode)
194195 if (!shouldInternalize(*I, ExternalNames))
195196 continue;
196197
198 I->setVisibility(GlobalValue::DefaultVisibility);
197199 I->setLinkage(GlobalValue::InternalLinkage);
198200 Changed = true;
199201 ++NumGlobals;
206208 if (!shouldInternalize(*I, ExternalNames))
207209 continue;
208210
211 I->setVisibility(GlobalValue::DefaultVisibility);
209212 I->setLinkage(GlobalValue::InternalLinkage);
210213 Changed = true;
211214 ++NumAliases;
0 ; RUN: opt < %s -internalize -S | FileCheck %s
1 ; Internalized symbols should have default visibility.
2
3 ; CHECK: @global = global i32 0
4 @global = global i32 0
5 @llvm.used = appending global [1 x i32*] [i32* @global]
6
7 ; CHECK: @hidden.variable = internal global i32 0
8 @hidden.variable = hidden global i32 0
9 ; CHECK: @protected.variable = internal global i32 0
10 @protected.variable = protected global i32 0
11
12 ; CHECK: @hidden.alias = alias internal i32* @global
13 @hidden.alias = hidden alias i32* @global
14 ; CHECK: @protected.alias = alias internal i32* @global
15 @protected.alias = protected alias i32* @global
16
17 ; CHECK: define internal void @hidden.function() {
18 define hidden void @hidden.function() {
19 ret void
20 }
21 ; CHECK: define internal void @protected.function() {
22 define protected void @protected.function() {
23 ret void
24 }