llvm.org GIT mirror llvm / c97b265
Fix PR26152. Fix the condition for when the new global takes over the name of the existing one to be the negation of the condition for the new global to get internal linkage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258355 91177308-0d34-0410-b5e6-96231b3b80d8 Evgeniy Stepanov 4 years ago
3 changed file(s) with 32 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
10861086 return nullptr;
10871087
10881088 NewGV = copyGlobalValueProto(SGV, ShouldLink);
1089 if (!ForAlias)
1089 if (ShouldLink || !ForAlias)
10901090 forceRenaming(NewGV, SGV->getName());
10911091 }
10921092 if (ShouldLink || ForAlias) {
0 define void @B() {
1 call void @A()
2 ret void
3 }
4
5 declare void @A()
6
0 ; RUN: llvm-link %s %S/Inputs/alias-2.ll -S -o - | FileCheck %s
1 ; RUN: llvm-link %S/Inputs/alias-2.ll %s -S -o - | FileCheck %s
2
3 ; Test the fix for PR26152, where A from the second module is
4 ; erroneously renamed to A.1 and not linked to the declaration from
5 ; the first module
6
7 @C = alias void (), void ()* @A
8
9 define void @D() {
10 call void @C()
11 ret void
12 }
13
14 define void @A() {
15 ret void
16 }
17
18 ; CHECK-DAG: @C = alias void (), void ()* @A
19 ; CHECK-DAG: define void @B()
20 ; CHECK-DAG: call void @A()
21 ; CHECK-DAG: define void @D()
22 ; CHECK-DAG: call void @C()
23 ; CHECK-DAG: define void @A()