Fix another case where the linkage was not set.

llvm-svn: 255272
This commit is contained in:
Rafael Espindola 2015-12-10 18:44:26 +00:00
parent 1cf66e30a9
commit 43562b355d
3 changed files with 13 additions and 2 deletions

View File

@ -831,7 +831,7 @@ static bool useExistingDest(GlobalValue &SGV, GlobalValue *DGV,
if (SGV.isDeclaration())
return true;
if (DGV->isDeclarationForLinker())
if (DGV->isDeclarationForLinker() && !SGV.isDeclarationForLinker())
return false;
if (ShouldLink)

View File

@ -1,5 +1,10 @@
@h = global void ()* @f
@h2 = global void ()* @g
define available_externally void @f() {
ret void
}
define available_externally void @g() {
ret void
}

View File

@ -2,8 +2,14 @@
declare void @f()
define available_externally void @g() {
ret void
}
define void ()* @main() {
call void @g()
ret void ()* @f
}
; CHECK: define available_externally void @f() {
; CHECK-DAG: define available_externally void @g() {
; CHECK-DAG: define available_externally void @f() {