Fix another case where the linkage was not set.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255272 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-12-10 18:44:26 +00:00
parent ef0af93883
commit 161d4c68fc
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() {