llvm.org GIT mirror llvm / 0178d23
Link declaration lazily. We already linked available_externally and linkonce lazily, this just adds declarations to the list. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254917 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
14 changed file(s) with 64 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
17521752 GV.hasAvailableExternallyLinkage()))
17531753 return false;
17541754
1755 if (GV.isDeclaration())
1756 return false;
1757
17551758 if (const Comdat *SC = GV.getComdat()) {
17561759 bool LinkFromSrc;
17571760 Comdat::SelectionKind SK;
33
44 declare void @foo()
55
6 define void @use_foo() {
7 call void @foo()
8 ret void
9 }
55 ; CHECK-NEXT: ret i32 7
66 ; CHECK-NEXT: }
77
8 ; CHECK: declare i32 @foo()
9
108 ; CHECK: define i32 @test() {
119 ; CHECK-NEXT: %X = call i32 @foo()
1210 ; CHECK-NEXT: ret i32 %X
1311 ; CHECK-NEXT: }
12
13 ; CHECK: declare i32 @foo()
1414
1515 declare i32 @foo()
1616
55
66 ; CHECK-DAG: @Y = external global [1 x i32]
77 @Y = external global [1 x i32]
8
9 define [1 x i32]* @use-Y() {
10 ret [1 x i32] *@Y
11 }
1010 getelementptr %A, %A* null, i32 0
1111 ret void
1212 }
13
14 define %A* @use_g2() {
15 ret %A* @g2
16 }
17
18 define %B* @use_g3() {
19 ret %B* @g3
20 }
5252 ret void
5353 }
5454
55 declare void @VecSizeCrash1(%VecSize)
55 define void @VecSizeCrash1(%VecSize) {
56 ret void
57 }
0 %A.11 = type { %B }
11 %B = type { i8 }
22 @g1 = external global %A.11
3
4 define %A.11* @use_g1() {
5 ret %A.11* @g1
6 }
0 %A.11 = type opaque
11 @g2 = external global %A.11
2
3 define %A.11* @use_g2() {
4 ret %A.11* @g2
5 }
1818 %C = type { %A }
1919
2020 @g1 = external global %B
21
22 define %B* @use_g1() {
23 ret %B* @g1
24 }
3131
3232 ; CHECK-DAG: @0 = external global i32
3333 @0 = external global i32
34
35 define i32* @use0() {
36 ret i32* @0
37 }
38
3439 ; CHECK-DAG: @Inte = global i32 1
3540 @Inte = global i32 1
3641
100105 ret void
101106 }
102107
103 declare void @VecSizeCrash(%VecSize)
108 define void @VecSizeCrash(%VecSize) {
109 ret void
110 }
1616 %A = type { %B }
1717 %B = type { i8 }
1818 @g3 = external global %A
19
20 define %A* @use_g3() {
21 ret %A* @g3
22 }
99 ; CHECK-NEXT: %B = type { %A }
1010 ; CHECK-NEXT: %A = type { i8 }
1111
12 ; CHECK: @g1 = external global %C.0
12 ; CHECK: @g1 = global %C.0 zeroinitializer
1313 ; CHECK: getelementptr %C.0, %C.0* null, i64 0, i32 0, i32 0
1414
1515 %A = type { i8 }
2020 getelementptr %C, %C* null, i64 0, i32 0, i32 0
2121 ret void
2222 }
23 @g1 = external global %C.0
23 @g1 = global %C.0 zeroinitializer
1414 @global-c = common unnamed_addr global i32 0
1515 ; CHECK-DAG: @global-c = common unnamed_addr global i32 0
1616 @global-d = external global i32
17
18 define i32* @use-global-d() {
19 ret i32* @global-d
20 }
21
1722 ; CHECK-DAG: @global-d = global i32 42
1823 @global-e = external unnamed_addr global i32
1924 ; CHECK-DAG: @global-e = unnamed_addr global i32 42
2631 ; CHECK-DAG: @alias-b = unnamed_addr alias i32, i32* @global-f
2732
2833 declare void @func-c()
34 define void @use-func-c() {
35 call void @func-c()
36 ret void
37 }
38
2939 ; CHECK-DAG: define weak void @func-c() {
3040 define weak void @func-d() { ret void }
3141 ; CHECK-DAG: define weak void @func-d() {
55 @kallsyms_names = extern_weak global [0 x i8]
66 @MyVar = extern_weak global i32
77 @Inte = extern_weak global i32
8
9 define weak [0 x i8]* @use_kallsyms_names() {
10 ret [0 x i8]* @kallsyms_names
11 }