We were deciding to not link an available_externally gv over a
declaration, but then copying over the body anyway.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255169
91177308-0d34-0410-b5e6-
96231b3b80d8
return false;
}
// If the Dest is weak, use the source linkage.
- LinkFromSrc = Dest.hasExternalWeakLinkage();
+ if (Dest.hasExternalWeakLinkage()) {
+ LinkFromSrc = true;
+ return false;
+ }
+ // Link an available_externally over a declaration.
+ LinkFromSrc = !Src.isDeclaration() && Dest.isDeclaration();
return false;
}
--- /dev/null
+@h = global void ()* @f
+
+define available_externally void @f() {
+ ret void
+}
--- /dev/null
+; RUN: llvm-link -S %s %p/Inputs/available_externally_over_decl.ll | FileCheck %s
+
+declare void @f()
+
+define void ()* @main() {
+ ret void ()* @f
+}
+
+; CHECK: define available_externally void @f() {