2015-11-22 05:55:48 +08:00
|
|
|
; First ensure that the ThinLTO handling in the gold plugin handles
|
2016-03-15 08:04:37 +08:00
|
|
|
; bitcode without summary sections gracefully.
|
2015-11-22 05:55:48 +08:00
|
|
|
; RUN: llvm-as %s -o %t.o
|
|
|
|
; RUN: llvm-as %p/Inputs/thinlto.ll -o %t2.o
|
|
|
|
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
2017-01-04 22:43:51 +08:00
|
|
|
; RUN: -m elf_x86_64 \
|
2015-11-22 05:55:48 +08:00
|
|
|
; RUN: --plugin-opt=thinlto \
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: --plugin-opt=thinlto-index-only \
|
2015-11-22 05:55:48 +08:00
|
|
|
; RUN: -shared %t.o %t2.o -o %t3
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: not test -e %t3
|
|
|
|
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
2017-01-04 22:43:51 +08:00
|
|
|
; RUN: -m elf_x86_64 \
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: --plugin-opt=thinlto \
|
|
|
|
; RUN: -shared %t.o %t2.o -o %t4
|
|
|
|
; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
|
2015-11-22 05:55:48 +08:00
|
|
|
|
2016-03-15 08:04:37 +08:00
|
|
|
; Next generate summary sections and test gold handling.
|
2016-04-13 05:35:18 +08:00
|
|
|
; RUN: opt -module-summary %s -o %t.o
|
|
|
|
; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o
|
2015-10-04 22:33:43 +08:00
|
|
|
|
2016-03-05 01:06:02 +08:00
|
|
|
; Ensure gold generates an index and not a binary if requested.
|
2015-10-04 22:33:43 +08:00
|
|
|
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
2017-01-04 22:43:51 +08:00
|
|
|
; RUN: -m elf_x86_64 \
|
2015-10-04 22:33:43 +08:00
|
|
|
; RUN: --plugin-opt=thinlto \
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: --plugin-opt=thinlto-index-only \
|
2015-10-04 22:33:43 +08:00
|
|
|
; RUN: -shared %t.o %t2.o -o %t3
|
2016-05-10 21:48:23 +08:00
|
|
|
; RUN: llvm-bcanalyzer -dump %t.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND1
|
|
|
|
; RUN: llvm-bcanalyzer -dump %t2.o.thinlto.bc | FileCheck %s --check-prefix=BACKEND2
|
2015-10-04 22:33:43 +08:00
|
|
|
; RUN: not test -e %t3
|
|
|
|
|
2016-08-11 22:58:12 +08:00
|
|
|
; Ensure gold generates an index as well as a binary with save-temps in ThinLTO mode.
|
2016-03-05 01:06:02 +08:00
|
|
|
; First force single-threaded mode
|
|
|
|
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
2017-01-04 22:43:51 +08:00
|
|
|
; RUN: -m elf_x86_64 \
|
2016-08-11 22:58:12 +08:00
|
|
|
; RUN: --plugin-opt=save-temps \
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: --plugin-opt=thinlto \
|
|
|
|
; RUN: --plugin-opt=jobs=1 \
|
|
|
|
; RUN: -shared %t.o %t2.o -o %t4
|
2016-08-11 22:58:12 +08:00
|
|
|
; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
|
|
|
|
|
2016-08-20 09:24:07 +08:00
|
|
|
; Check with --no-map-whole-files
|
|
|
|
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
2017-01-04 22:43:51 +08:00
|
|
|
; RUN: -m elf_x86_64 \
|
2016-08-20 09:24:07 +08:00
|
|
|
; RUN: --plugin-opt=save-temps \
|
|
|
|
; RUN: --plugin-opt=thinlto \
|
|
|
|
; RUN: --plugin-opt=jobs=1 \
|
|
|
|
; RUN: --no-map-whole-files \
|
|
|
|
; RUN: -shared %t.o %t2.o -o %t4
|
|
|
|
; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED
|
|
|
|
; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
|
|
|
|
|
2016-03-05 01:06:02 +08:00
|
|
|
; Next force multi-threaded mode
|
|
|
|
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
2017-01-04 22:43:51 +08:00
|
|
|
; RUN: -m elf_x86_64 \
|
2016-08-11 22:58:12 +08:00
|
|
|
; RUN: --plugin-opt=save-temps \
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: --plugin-opt=thinlto \
|
|
|
|
; RUN: --plugin-opt=jobs=2 \
|
|
|
|
; RUN: -shared %t.o %t2.o -o %t4
|
2016-08-11 22:58:12 +08:00
|
|
|
; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
|
|
|
|
|
|
|
|
; Test --plugin-opt=obj-path to ensure unique object files generated.
|
2017-01-26 10:15:08 +08:00
|
|
|
; RUN: rm -f %t5.o %t5.o1
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
2017-01-04 22:43:51 +08:00
|
|
|
; RUN: -m elf_x86_64 \
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: --plugin-opt=thinlto \
|
|
|
|
; RUN: --plugin-opt=jobs=2 \
|
|
|
|
; RUN: --plugin-opt=obj-path=%t5.o \
|
|
|
|
; RUN: -shared %t.o %t2.o -o %t4
|
2017-01-26 10:15:08 +08:00
|
|
|
; RUN: llvm-nm %t5.o | FileCheck %s --check-prefix=NM2
|
2016-03-05 01:06:02 +08:00
|
|
|
; RUN: llvm-nm %t5.o1 | FileCheck %s --check-prefix=NM2
|
|
|
|
|
|
|
|
; NM: T f
|
|
|
|
; NM2: T {{f|g}}
|
|
|
|
|
2016-05-10 21:48:23 +08:00
|
|
|
; The backend index for this module contains summaries from itself and
|
|
|
|
; Inputs/thinlto.ll, as it imports from the latter.
|
|
|
|
; BACKEND1: <MODULE_STRTAB_BLOCK
|
|
|
|
; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'
|
|
|
|
; BACKEND1-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'
|
|
|
|
; BACKEND1-NEXT: </MODULE_STRTAB_BLOCK
|
|
|
|
; BACKEND1-NEXT: <GLOBALVAL_SUMMARY_BLOCK
|
|
|
|
; BACKEND1-NEXT: <VERSION
|
2017-04-18 01:51:36 +08:00
|
|
|
; BACKEND1-NEXT: <VALUE_GUID op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
|
|
|
|
; BACKEND1-NEXT: <VALUE_GUID op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
|
2016-05-10 21:48:23 +08:00
|
|
|
; BACKEND1-NEXT: <COMBINED
|
|
|
|
; BACKEND1-NEXT: <COMBINED
|
|
|
|
; BACKEND1-NEXT: </GLOBALVAL_SUMMARY_BLOCK
|
|
|
|
|
|
|
|
; The backend index for Input/thinlto.ll contains summaries from itself only,
|
|
|
|
; as it does not import anything.
|
|
|
|
; BACKEND2: <MODULE_STRTAB_BLOCK
|
|
|
|
; BACKEND2-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp2.o'
|
|
|
|
; BACKEND2-NEXT: </MODULE_STRTAB_BLOCK
|
|
|
|
; BACKEND2-NEXT: <GLOBALVAL_SUMMARY_BLOCK
|
|
|
|
; BACKEND2-NEXT: <VERSION
|
2017-04-18 01:51:36 +08:00
|
|
|
; BACKEND2-NEXT: <VALUE_GUID op0=1 op1=-5300342847281564238
|
2016-05-10 21:48:23 +08:00
|
|
|
; BACKEND2-NEXT: <COMBINED
|
|
|
|
; BACKEND2-NEXT: </GLOBALVAL_SUMMARY_BLOCK
|
|
|
|
|
2015-10-04 22:33:43 +08:00
|
|
|
; COMBINED: <MODULE_STRTAB_BLOCK
|
2015-10-08 23:56:24 +08:00
|
|
|
; COMBINED-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'
|
|
|
|
; COMBINED-NEXT: <ENTRY {{.*}} record string = '{{.*}}/test/tools/gold/X86/Output/thinlto.ll.tmp{{.*}}.o'
|
2015-10-04 22:33:43 +08:00
|
|
|
; COMBINED-NEXT: </MODULE_STRTAB_BLOCK
|
[ThinLTO] Support for reference graph in per-module and combined summary.
Summary:
This patch adds support for including a full reference graph including
call graph edges and other GV references in the summary.
The reference graph edges can be used to make importing decisions
without materializing any source modules, can be used in the plugin
to make file staging decisions for distributed build systems, and is
expected to have other uses.
The call graph edges are recorded in each function summary in the
bitcode via a list of <CalleeValueIds, StaticCount> tuples when no PGO
data exists, or <CalleeValueId, StaticCount, ProfileCount> pairs when
there is PGO, where the ValueId can be mapped to the function GUID via
the ValueSymbolTable. In the function index in memory, the call graph
edges reference the target via the CalleeGUID instead of the
CalleeValueId.
The reference graph edges are recorded in each summary record with a
list of referenced value IDs, which can be mapped to value GUID via the
ValueSymbolTable.
Addtionally, a new summary record type is added to record references
from global variable initializers. A number of bitcode records and data
structures have been renamed to reflect the newly expanded scope of the
summary beyond functions. More cleanup will follow.
Reviewers: joker.eph, davidxl
Subscribers: joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D17212
llvm-svn: 263275
2016-03-12 02:52:24 +08:00
|
|
|
; COMBINED-NEXT: <GLOBALVAL_SUMMARY_BLOCK
|
2016-04-24 16:02:00 +08:00
|
|
|
; COMBINED-NEXT: <VERSION
|
2017-04-18 01:51:36 +08:00
|
|
|
; COMBINED-NEXT: <VALUE_GUID op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
|
|
|
|
; COMBINED-NEXT: <VALUE_GUID op0={{1|2}} op1={{-3706093650706652785|-5300342847281564238}}
|
[ThinLTO] Support for reference graph in per-module and combined summary.
Summary:
This patch adds support for including a full reference graph including
call graph edges and other GV references in the summary.
The reference graph edges can be used to make importing decisions
without materializing any source modules, can be used in the plugin
to make file staging decisions for distributed build systems, and is
expected to have other uses.
The call graph edges are recorded in each function summary in the
bitcode via a list of <CalleeValueIds, StaticCount> tuples when no PGO
data exists, or <CalleeValueId, StaticCount, ProfileCount> pairs when
there is PGO, where the ValueId can be mapped to the function GUID via
the ValueSymbolTable. In the function index in memory, the call graph
edges reference the target via the CalleeGUID instead of the
CalleeValueId.
The reference graph edges are recorded in each summary record with a
list of referenced value IDs, which can be mapped to value GUID via the
ValueSymbolTable.
Addtionally, a new summary record type is added to record references
from global variable initializers. A number of bitcode records and data
structures have been renamed to reflect the newly expanded scope of the
summary beyond functions. More cleanup will follow.
Reviewers: joker.eph, davidxl
Subscribers: joker.eph, llvm-commits
Differential Revision: http://reviews.llvm.org/D17212
llvm-svn: 263275
2016-03-12 02:52:24 +08:00
|
|
|
; COMBINED-NEXT: <COMBINED
|
|
|
|
; COMBINED-NEXT: <COMBINED
|
|
|
|
; COMBINED-NEXT: </GLOBALVAL_SUMMARY_BLOCK
|
2015-10-04 22:33:43 +08:00
|
|
|
|
2016-12-15 05:57:04 +08:00
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
2017-01-04 22:43:51 +08:00
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
2016-12-15 05:57:04 +08:00
|
|
|
|
2016-03-05 01:06:02 +08:00
|
|
|
declare void @g(...)
|
|
|
|
|
2015-10-04 22:33:43 +08:00
|
|
|
define void @f() {
|
|
|
|
entry:
|
2016-03-05 01:06:02 +08:00
|
|
|
call void (...) @g()
|
2015-10-04 22:33:43 +08:00
|
|
|
ret void
|
|
|
|
}
|