Restore "Move metadata linking after lazy global materialization/linking."
Summary:
This reverts commit r251965.
Restore "Move metadata linking after lazy global materialization/linking."
This restores commit r251926, with fixes for the LTO bootstrapping bot
failure.
The bot failure was caused by references from debug metadata to
otherwise unreferenced globals. Previously, this caused the lazy linking
to link in their defs, which is unnecessary. With this patch, because
lazy linking is complete when we encounter the metadata reference, the
materializer created a declaration. For definitions such as aliases and
comdats, it is illegal to have a declaration. Furthermore, metadata
linking should not change code generation. Therefore, when linking of
global value bodies is complete, the materializer will simply return
nullptr as the new reference for the linked metadata.
This change required fixing a different test to ensure there was a
real reference to a linkonce global that was only being reference from
metadata.
Note that the new changes to the only-needed-named-metadata.ll test
illustrate an issue with llvm-link -only-needed handling of comdat
groups, whereby it may result in an incomplete comdat group. I note this
in the test comments, but the issue is orthogonal to this patch (it can
be reproduced without any metadata at head).
Reviewers: dexonsmith, rafael, tra
Subscribers: tobiasvk, joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D14447
llvm-svn: 252320
2015-11-07 01:50:53 +08:00
|
|
|
; Without -only-needed we should lazy link linkonce globals, and the
|
|
|
|
; metadata reference should not cause them to be linked.
|
2015-11-28 07:47:15 +08:00
|
|
|
; RUN: llvm-link -S %S/Inputs/only-needed-named-metadata.ll %S/only-needed-named-metadata.ll | FileCheck %s
|
Restore "Move metadata linking after lazy global materialization/linking."
Summary:
This reverts commit r251965.
Restore "Move metadata linking after lazy global materialization/linking."
This restores commit r251926, with fixes for the LTO bootstrapping bot
failure.
The bot failure was caused by references from debug metadata to
otherwise unreferenced globals. Previously, this caused the lazy linking
to link in their defs, which is unnecessary. With this patch, because
lazy linking is complete when we encounter the metadata reference, the
materializer created a declaration. For definitions such as aliases and
comdats, it is illegal to have a declaration. Furthermore, metadata
linking should not change code generation. Therefore, when linking of
global value bodies is complete, the materializer will simply return
nullptr as the new reference for the linked metadata.
This change required fixing a different test to ensure there was a
real reference to a linkonce global that was only being reference from
metadata.
Note that the new changes to the only-needed-named-metadata.ll test
illustrate an issue with llvm-link -only-needed handling of comdat
groups, whereby it may result in an incomplete comdat group. I note this
in the test comments, but the issue is orthogonal to this patch (it can
be reproduced without any metadata at head).
Reviewers: dexonsmith, rafael, tra
Subscribers: tobiasvk, joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D14447
llvm-svn: 252320
2015-11-07 01:50:53 +08:00
|
|
|
; CHECK-NOT:@U_linkonce
|
|
|
|
; CHECK-NOT:@unused_linkonce()
|
|
|
|
|
|
|
|
; With -only-needed the metadata references should not cause any of the
|
|
|
|
; otherwise unreferenced globals to be linked. This also ensures that the
|
|
|
|
; metadata references don't provoke the module linker to create declarations,
|
|
|
|
; which are illegal for aliases and globals in comdats.
|
|
|
|
; Note that doing -only-needed with the comdat shown below leads to a only
|
|
|
|
; part of the comdat group being linked, which is not technically correct.
|
2015-11-28 07:47:15 +08:00
|
|
|
; RUN: llvm-link -S -only-needed %S/Inputs/only-needed-named-metadata.ll %S/only-needed-named-metadata.ll | FileCheck %s -check-prefix=ONLYNEEDED
|
|
|
|
; RUN: llvm-link -S -internalize -only-needed %S/Inputs/only-needed-named-metadata.ll %S/only-needed-named-metadata.ll | FileCheck %s -check-prefix=ONLYNEEDED
|
Restore "Move metadata linking after lazy global materialization/linking."
Summary:
This reverts commit r251965.
Restore "Move metadata linking after lazy global materialization/linking."
This restores commit r251926, with fixes for the LTO bootstrapping bot
failure.
The bot failure was caused by references from debug metadata to
otherwise unreferenced globals. Previously, this caused the lazy linking
to link in their defs, which is unnecessary. With this patch, because
lazy linking is complete when we encounter the metadata reference, the
materializer created a declaration. For definitions such as aliases and
comdats, it is illegal to have a declaration. Furthermore, metadata
linking should not change code generation. Therefore, when linking of
global value bodies is complete, the materializer will simply return
nullptr as the new reference for the linked metadata.
This change required fixing a different test to ensure there was a
real reference to a linkonce global that was only being reference from
metadata.
Note that the new changes to the only-needed-named-metadata.ll test
illustrate an issue with llvm-link -only-needed handling of comdat
groups, whereby it may result in an incomplete comdat group. I note this
in the test comments, but the issue is orthogonal to this patch (it can
be reproduced without any metadata at head).
Reviewers: dexonsmith, rafael, tra
Subscribers: tobiasvk, joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D14447
llvm-svn: 252320
2015-11-07 01:50:53 +08:00
|
|
|
; ONLYNEEDED-NOT:@U
|
|
|
|
; ONLYNEEDED-NOT:@U_linkonce
|
|
|
|
; ONLYNEEDED-NOT:@unused()
|
|
|
|
; ONLYNEEDED-NOT:@unused_linkonce()
|
|
|
|
; ONLYNEEDED-NOT:@linkoncealias
|
|
|
|
; ONLYNEEDED-NOT:@linkoncefunc2()
|
|
|
|
; ONLYNEEDED-NOT:@weakalias
|
|
|
|
; ONLYNEEDED-NOT:@globalfunc1()
|
|
|
|
; ONLYNEEDED-NOT:@analias
|
|
|
|
; ONLYNEEDED-NOT:@globalfunc2()
|
2015-11-07 01:50:48 +08:00
|
|
|
|
|
|
|
@X = global i32 5
|
|
|
|
@U = global i32 6
|
Restore "Move metadata linking after lazy global materialization/linking."
Summary:
This reverts commit r251965.
Restore "Move metadata linking after lazy global materialization/linking."
This restores commit r251926, with fixes for the LTO bootstrapping bot
failure.
The bot failure was caused by references from debug metadata to
otherwise unreferenced globals. Previously, this caused the lazy linking
to link in their defs, which is unnecessary. With this patch, because
lazy linking is complete when we encounter the metadata reference, the
materializer created a declaration. For definitions such as aliases and
comdats, it is illegal to have a declaration. Furthermore, metadata
linking should not change code generation. Therefore, when linking of
global value bodies is complete, the materializer will simply return
nullptr as the new reference for the linked metadata.
This change required fixing a different test to ensure there was a
real reference to a linkonce global that was only being reference from
metadata.
Note that the new changes to the only-needed-named-metadata.ll test
illustrate an issue with llvm-link -only-needed handling of comdat
groups, whereby it may result in an incomplete comdat group. I note this
in the test comments, but the issue is orthogonal to this patch (it can
be reproduced without any metadata at head).
Reviewers: dexonsmith, rafael, tra
Subscribers: tobiasvk, joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D14447
llvm-svn: 252320
2015-11-07 01:50:53 +08:00
|
|
|
@U_linkonce = linkonce_odr hidden global i32 6
|
2015-11-07 01:50:48 +08:00
|
|
|
define i32 @foo() { ret i32 7 }
|
|
|
|
define i32 @unused() { ret i32 8 }
|
Restore "Move metadata linking after lazy global materialization/linking."
Summary:
This reverts commit r251965.
Restore "Move metadata linking after lazy global materialization/linking."
This restores commit r251926, with fixes for the LTO bootstrapping bot
failure.
The bot failure was caused by references from debug metadata to
otherwise unreferenced globals. Previously, this caused the lazy linking
to link in their defs, which is unnecessary. With this patch, because
lazy linking is complete when we encounter the metadata reference, the
materializer created a declaration. For definitions such as aliases and
comdats, it is illegal to have a declaration. Furthermore, metadata
linking should not change code generation. Therefore, when linking of
global value bodies is complete, the materializer will simply return
nullptr as the new reference for the linked metadata.
This change required fixing a different test to ensure there was a
real reference to a linkonce global that was only being reference from
metadata.
Note that the new changes to the only-needed-named-metadata.ll test
illustrate an issue with llvm-link -only-needed handling of comdat
groups, whereby it may result in an incomplete comdat group. I note this
in the test comments, but the issue is orthogonal to this patch (it can
be reproduced without any metadata at head).
Reviewers: dexonsmith, rafael, tra
Subscribers: tobiasvk, joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D14447
llvm-svn: 252320
2015-11-07 01:50:53 +08:00
|
|
|
define linkonce_odr hidden i32 @unused_linkonce() { ret i32 8 }
|
|
|
|
@linkoncealias = alias void (...), bitcast (void ()* @linkoncefunc2 to void (...)*)
|
|
|
|
|
|
|
|
@weakalias = weak alias void (...), bitcast (void ()* @globalfunc1 to void (...)*)
|
|
|
|
@analias = alias void (...), bitcast (void ()* @globalfunc2 to void (...)*)
|
|
|
|
|
|
|
|
define void @globalfunc1() #0 {
|
|
|
|
entry:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @globalfunc2() #0 {
|
|
|
|
entry:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
$linkoncefunc2 = comdat any
|
|
|
|
define linkonce_odr void @linkoncefunc2() #0 comdat {
|
|
|
|
entry:
|
|
|
|
ret void
|
|
|
|
}
|
2015-11-07 01:50:48 +08:00
|
|
|
|
2015-11-11 05:09:06 +08:00
|
|
|
!llvm.named = !{!0, !1, !2, !3, !4, !5, !6}
|
2015-11-07 01:50:48 +08:00
|
|
|
!0 = !{i32 ()* @unused}
|
|
|
|
!1 = !{i32* @U}
|
Restore "Move metadata linking after lazy global materialization/linking."
Summary:
This reverts commit r251965.
Restore "Move metadata linking after lazy global materialization/linking."
This restores commit r251926, with fixes for the LTO bootstrapping bot
failure.
The bot failure was caused by references from debug metadata to
otherwise unreferenced globals. Previously, this caused the lazy linking
to link in their defs, which is unnecessary. With this patch, because
lazy linking is complete when we encounter the metadata reference, the
materializer created a declaration. For definitions such as aliases and
comdats, it is illegal to have a declaration. Furthermore, metadata
linking should not change code generation. Therefore, when linking of
global value bodies is complete, the materializer will simply return
nullptr as the new reference for the linked metadata.
This change required fixing a different test to ensure there was a
real reference to a linkonce global that was only being reference from
metadata.
Note that the new changes to the only-needed-named-metadata.ll test
illustrate an issue with llvm-link -only-needed handling of comdat
groups, whereby it may result in an incomplete comdat group. I note this
in the test comments, but the issue is orthogonal to this patch (it can
be reproduced without any metadata at head).
Reviewers: dexonsmith, rafael, tra
Subscribers: tobiasvk, joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D14447
llvm-svn: 252320
2015-11-07 01:50:53 +08:00
|
|
|
!2 = !{i32 ()* @unused_linkonce}
|
|
|
|
!3 = !{i32* @U_linkonce}
|
|
|
|
!4 = !{void (...)* @weakalias}
|
|
|
|
!5 = !{void (...)* @analias}
|
|
|
|
!6 = !{void (...)* @linkoncealias}
|