2016-04-21 13:47:17 +08:00
|
|
|
; RUN: opt -module-summary %s -o %t1.bc
|
|
|
|
; RUN: opt -module-summary %p/Inputs/alias_import.ll -o %t2.bc
|
|
|
|
; RUN: llvm-lto -thinlto-action=thinlink -o %t.index.bc %t1.bc %t2.bc
|
2018-07-12 04:25:49 +08:00
|
|
|
; RUN: llvm-lto -thinlto-action=promote -thinlto-index %t.index.bc %t2.bc -o - | llvm-dis -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix=PROMOTE
|
|
|
|
; RUN: llvm-lto -thinlto-action=import -thinlto-index %t.index.bc %t1.bc -o - | llvm-dis -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix=IMPORT
|
2016-04-21 13:47:17 +08:00
|
|
|
|
2017-12-16 08:18:12 +08:00
|
|
|
; Alias can't point to "available_externally", so they are implemented by
|
|
|
|
; importing the alias as an available_externally definition copied from the
|
|
|
|
; aliasee's body.
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @globalfuncAlias = alias void (...), bitcast (void ()* @globalfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @globalfuncWeakAlias = weak alias void (...), bitcast (void ()* @globalfunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @globalfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @globalfunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @globalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @globalfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
|
2016-11-15 03:21:41 +08:00
|
|
|
; PROMOTE-DAG: @internalfuncAlias = alias void (...), bitcast (void ()* @internalfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @internalfuncWeakAlias = weak alias void (...), bitcast (void ()* @internalfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @internalfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @internalfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @internalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @internalfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @linkoncefuncAlias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @linkoncefuncWeakAlias = weak alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @linkoncefuncLinkonceAlias = weak alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @linkoncefuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @linkoncefuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @weakfuncAlias = alias void (...), bitcast (void ()* @weakfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @weakfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakfunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @weakfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @weakfunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @weakfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @weakfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @weakODRfuncAlias = alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @weakODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @weakODRfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @weakODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @weakODRfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @linkonceODRfuncAlias = alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @linkonceODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
|
|
|
|
; PROMOTE-DAG: @linkonceODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
|
2016-07-08 02:31:51 +08:00
|
|
|
; PROMOTE-DAG: @linkonceODRfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: @linkonceODRfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
|
|
|
|
|
[ThinLTO] Use original alias visibility when importing
Summary:
When we import an alias, we do so by making a clone of the aliasee. Just
as this clone uses the original alias name and linkage, it should also
use the same visibility (not the aliasee's visibility). Otherwise,
linker behavior is affected (e.g. if the aliasee was hidden, but the
alias is not, the resulting imported clone should not be hidden,
otherwise the linker will make the final symbol hidden which is
incorrect).
Reviewers: wmi
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62535
llvm-svn: 361989
2019-05-30 00:50:46 +08:00
|
|
|
; PROMOTE-DAG: define hidden void @globalfunc()
|
2016-11-15 03:21:41 +08:00
|
|
|
; PROMOTE-DAG: define internal void @internalfunc()
|
2016-10-30 13:15:23 +08:00
|
|
|
; PROMOTE-DAG: define weak_odr void @linkonceODRfunc()
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: define weak_odr void @weakODRfunc()
|
2016-10-30 13:15:23 +08:00
|
|
|
; PROMOTE-DAG: define weak void @linkoncefunc()
|
2016-04-21 13:47:17 +08:00
|
|
|
; PROMOTE-DAG: define weak void @weakfunc()
|
|
|
|
|
2017-12-16 08:18:12 +08:00
|
|
|
; On the import side now, verify that aliases are imported unless they
|
|
|
|
; are preemptible (non-ODR weak/linkonce).
|
|
|
|
; IMPORT-DAG: declare void @linkonceODRfuncWeakAlias
|
|
|
|
; IMPORT-DAG: declare void @linkonceODRfuncLinkonceAlias
|
|
|
|
; IMPORT-DAG: define available_externally void @linkonceODRfuncAlias
|
|
|
|
; IMPORT-DAG: define available_externally void @linkonceODRfuncWeakODRAlias
|
|
|
|
; IMPORT-DAG: define available_externally void @linkonceODRfuncLinkonceODRAlias
|
[ThinLTO] Use original alias visibility when importing
Summary:
When we import an alias, we do so by making a clone of the aliasee. Just
as this clone uses the original alias name and linkage, it should also
use the same visibility (not the aliasee's visibility). Otherwise,
linker behavior is affected (e.g. if the aliasee was hidden, but the
alias is not, the resulting imported clone should not be hidden,
otherwise the linker will make the final symbol hidden which is
incorrect).
Reviewers: wmi
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62535
llvm-svn: 361989
2019-05-30 00:50:46 +08:00
|
|
|
; IMPORT-DAG: define available_externally dso_local void @globalfuncAlias()
|
2016-04-21 13:47:17 +08:00
|
|
|
; IMPORT-DAG: declare void @globalfuncWeakAlias()
|
|
|
|
; IMPORT-DAG: declare void @globalfuncLinkonceAlias()
|
[ThinLTO] Use original alias visibility when importing
Summary:
When we import an alias, we do so by making a clone of the aliasee. Just
as this clone uses the original alias name and linkage, it should also
use the same visibility (not the aliasee's visibility). Otherwise,
linker behavior is affected (e.g. if the aliasee was hidden, but the
alias is not, the resulting imported clone should not be hidden,
otherwise the linker will make the final symbol hidden which is
incorrect).
Reviewers: wmi
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62535
llvm-svn: 361989
2019-05-30 00:50:46 +08:00
|
|
|
; IMPORT-DAG: define available_externally dso_local void @globalfuncWeakODRAlias()
|
|
|
|
; IMPORT-DAG: define available_externally dso_local void @globalfuncLinkonceODRAlias()
|
2018-01-12 06:15:05 +08:00
|
|
|
; IMPORT-DAG: define available_externally dso_local void @internalfuncAlias()
|
2016-04-21 13:47:17 +08:00
|
|
|
; IMPORT-DAG: declare void @internalfuncWeakAlias()
|
|
|
|
; IMPORT-DAG: declare void @internalfuncLinkonceAlias()
|
2018-01-12 06:15:05 +08:00
|
|
|
; IMPORT-DAG: define available_externally dso_local void @internalfuncWeakODRAlias()
|
|
|
|
; IMPORT-DAG: define available_externally dso_local void @internalfuncLinkonceODRAlias()
|
2017-12-16 08:18:12 +08:00
|
|
|
; IMPORT-DAG: define available_externally void @weakODRfuncAlias()
|
2016-04-21 13:47:17 +08:00
|
|
|
; IMPORT-DAG: declare void @weakODRfuncWeakAlias()
|
|
|
|
; IMPORT-DAG: declare void @weakODRfuncLinkonceAlias()
|
2017-12-16 08:18:12 +08:00
|
|
|
; IMPORT-DAG: define available_externally void @weakODRfuncWeakODRAlias()
|
|
|
|
; IMPORT-DAG: define available_externally void @weakODRfuncLinkonceODRAlias()
|
|
|
|
; IMPORT-DAG: define available_externally void @linkoncefuncAlias()
|
2016-04-21 13:47:17 +08:00
|
|
|
; IMPORT-DAG: declare void @linkoncefuncWeakAlias()
|
|
|
|
; IMPORT-DAG: declare void @linkoncefuncLinkonceAlias()
|
2017-12-16 08:18:12 +08:00
|
|
|
; IMPORT-DAG: define available_externally void @linkoncefuncWeakODRAlias()
|
|
|
|
; IMPORT-DAG: define available_externally void @linkoncefuncLinkonceODRAlias()
|
|
|
|
; IMPORT-DAG: define available_externally void @weakfuncAlias()
|
2016-04-21 13:47:17 +08:00
|
|
|
; IMPORT-DAG: declare void @weakfuncWeakAlias()
|
|
|
|
; IMPORT-DAG: declare void @weakfuncLinkonceAlias()
|
2017-12-16 08:18:12 +08:00
|
|
|
; IMPORT-DAG: define available_externally void @weakfuncWeakODRAlias()
|
|
|
|
; IMPORT-DAG: define available_externally void @weakfuncLinkonceODRAlias()
|
|
|
|
; IMPORT-DAG: define available_externally void @linkonceODRfuncAlias()
|
2017-07-27 23:09:06 +08:00
|
|
|
; IMPORT-DAG: declare void @linkonceODRfuncWeakAlias()
|
2017-12-16 08:18:12 +08:00
|
|
|
; IMPORT-DAG: define available_externally void @linkonceODRfuncWeakODRAlias()
|
2017-07-27 23:09:06 +08:00
|
|
|
; IMPORT-DAG: declare void @linkonceODRfuncLinkonceAlias()
|
2017-12-16 08:18:12 +08:00
|
|
|
; IMPORT-DAG: define available_externally void @linkonceODRfuncLinkonceODRAlias()
|
2016-04-21 13:47:17 +08:00
|
|
|
|
[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
Summary:
Reapply r357931 with fixes to ThinLTO testcases and llvm-lto tool.
ThinLTOCodeGenerator currently does not preserve llvm.used symbols and
it can internalize them. In order to pass the necessary information to the
legacy ThinLTOCodeGenerator, the input to the code generator is
rewritten to be based on lto::InputFile.
Now ThinLTO using the legacy LTO API will requires data layout in
Module.
"internalize" thinlto action in llvm-lto is updated to run both
"promote" and "internalize" with the same configuration as
ThinLTOCodeGenerator. The old "promote" + "internalize" option does not
produce the same output as ThinLTOCodeGenerator.
This fixes: PR41236
rdar://problem/49293439
Reviewers: tejohnson, pcc, kromanova, dexonsmith
Reviewed By: tejohnson
Subscribers: ormris, bd1976llvm, mehdi_amini, inglorion, eraman, hiraditya, jkorous, dexonsmith, arphaman, dang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60421
llvm-svn: 358601
2019-04-18 01:38:09 +08:00
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
|
2016-04-21 13:47:17 +08:00
|
|
|
define i32 @main() #0 {
|
|
|
|
entry:
|
|
|
|
call void @globalfuncAlias()
|
|
|
|
call void @globalfuncWeakAlias()
|
|
|
|
call void @globalfuncLinkonceAlias()
|
|
|
|
call void @globalfuncWeakODRAlias()
|
|
|
|
call void @globalfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
call void @internalfuncAlias()
|
|
|
|
call void @internalfuncWeakAlias()
|
|
|
|
call void @internalfuncLinkonceAlias()
|
|
|
|
call void @internalfuncWeakODRAlias()
|
|
|
|
call void @internalfuncLinkonceODRAlias()
|
|
|
|
call void @linkonceODRfuncAlias()
|
|
|
|
call void @linkonceODRfuncWeakAlias()
|
|
|
|
call void @linkonceODRfuncLinkonceAlias()
|
|
|
|
call void @linkonceODRfuncWeakODRAlias()
|
|
|
|
call void @linkonceODRfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
call void @weakODRfuncAlias()
|
|
|
|
call void @weakODRfuncWeakAlias()
|
|
|
|
call void @weakODRfuncLinkonceAlias()
|
|
|
|
call void @weakODRfuncWeakODRAlias()
|
|
|
|
call void @weakODRfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
call void @linkoncefuncAlias()
|
|
|
|
call void @linkoncefuncWeakAlias()
|
|
|
|
call void @linkoncefuncLinkonceAlias()
|
|
|
|
call void @linkoncefuncWeakODRAlias()
|
|
|
|
call void @linkoncefuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
call void @weakfuncAlias()
|
|
|
|
call void @weakfuncWeakAlias()
|
|
|
|
call void @weakfuncLinkonceAlias()
|
|
|
|
call void @weakfuncWeakODRAlias()
|
|
|
|
call void @weakfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
declare void @globalfuncAlias()
|
|
|
|
declare void @globalfuncWeakAlias()
|
|
|
|
declare void @globalfuncLinkonceAlias()
|
|
|
|
declare void @globalfuncWeakODRAlias()
|
|
|
|
declare void @globalfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
declare void @internalfuncAlias()
|
|
|
|
declare void @internalfuncWeakAlias()
|
|
|
|
declare void @internalfuncLinkonceAlias()
|
|
|
|
declare void @internalfuncWeakODRAlias()
|
|
|
|
declare void @internalfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
declare void @linkonceODRfuncAlias()
|
|
|
|
declare void @linkonceODRfuncWeakAlias()
|
|
|
|
declare void @linkonceODRfuncLinkonceAlias()
|
|
|
|
declare void @linkonceODRfuncWeakODRAlias()
|
|
|
|
declare void @linkonceODRfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
declare void @weakODRfuncAlias()
|
|
|
|
declare void @weakODRfuncWeakAlias()
|
|
|
|
declare void @weakODRfuncLinkonceAlias()
|
|
|
|
declare void @weakODRfuncWeakODRAlias()
|
|
|
|
declare void @weakODRfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
declare void @linkoncefuncAlias()
|
|
|
|
declare void @linkoncefuncWeakAlias()
|
|
|
|
declare void @linkoncefuncLinkonceAlias()
|
|
|
|
declare void @linkoncefuncWeakODRAlias()
|
|
|
|
declare void @linkoncefuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
declare void @weakfuncAlias()
|
|
|
|
declare void @weakfuncWeakAlias()
|
|
|
|
declare void @weakfuncLinkonceAlias()
|
|
|
|
declare void @weakfuncWeakODRAlias()
|
|
|
|
declare void @weakfuncLinkonceODRAlias()
|
|
|
|
|
|
|
|
|