1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/test/ThinLTO/X86/distributed_import.ll
Haojie Wang 13f5c24893 ThinLTO Minimized Bitcode File Size Reduction
Summary: Currently the ThinLTO minimized bitcode file only strip the debug info, but there is still a lot of information in the minimized bit code file that will be not used for thin linker. In this patch, most of the extra information is striped to reduce the minimized bitcode file. Now only ModuleVersion, ModuleInfo, ModuleGlobalValueSummary, ModuleHash, Symtab and Strtab are left. Now the minimized bitcode file size is reduced to 15%-30% of the debug info stripped bitcode file size.

Reviewers: danielcdh, tejohnson, pcc

Reviewed By: pcc

Subscribers: mehdi_amini, aprantl, inglorion, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D35334

llvm-svn: 308760
2017-07-21 17:25:20 +00:00

83 lines
2.9 KiB
LLVM

; Test distributed build thin link output from llvm-lto2
; Generate bitcode files with summary, as well as minimized bitcode without
; the debug metadata for the thin link.
; RUN: opt -thinlto-bc %s -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.bc
; RUN: opt -thinlto-bc %p/Inputs/distributed_import.ll -thin-link-bitcode-file=%t2.thinlink.bc -o %t2.bc
; RUN: llvm-bcanalyzer -dump %t1.thinlink.bc | FileCheck --check-prefix=THINLINKBITCODE %s
; First perform the thin link on the normal bitcode file.
; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
; RUN: -thinlto-distributed-indexes \
; RUN: -r=%t1.bc,g, \
; RUN: -r=%t1.bc,f,px \
; RUN: -r=%t2.bc,g,px
; RUN: opt -function-import -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out
; RUN: opt -function-import -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out
; RUN: llvm-dis -o - %t2.out | FileCheck %s
; Save the generated index files.
; RUN: cp %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig
; RUN: cp %t2.bc.thinlto.bc %t2.bc.thinlto.bc.orig
; Copy the minimized bitcode to the regular bitcode path so the module
; paths in the index are the same (save the regular bitcode for use again
; further down).
; RUN: cp %t1.bc %t1.bc.sv
; RUN: cp %t1.thinlink.bc %t1.bc
; RUN: cp %t2.bc %t2.bc.sv
; RUN: cp %t2.thinlink.bc %t2.bc
; Next perform the thin link on the minimized bitcode files, and compare dumps
; of the resulting indexes to the above dumps to ensure they are identical.
; RUN: rm -f %t1.bc.thinlto.bc %t2.bc.thinlto.bc
; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \
; RUN: -thinlto-distributed-indexes \
; RUN: -r=%t1.bc,g, \
; RUN: -r=%t1.bc,f,px \
; RUN: -r=%t2.bc,g,px
; RUN: diff %t1.bc.thinlto.bc.orig %t1.bc.thinlto.bc
; RUN: diff %t2.bc.thinlto.bc.orig %t2.bc.thinlto.bc
; Make sure importing occurs as expected
; RUN: cp %t1.bc.sv %t1.bc
; RUN: cp %t2.bc.sv %t2.bc
; RUN: opt -function-import -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out
; RUN: llvm-dis -o - %t2.out | FileCheck %s
; CHECK: @G.llvm.
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
declare i32 @g(...)
define void @f() {
entry:
call i32 (...) @g()
ret void
}
; THINLINKBITCODE-NOT: IDENTIFICATION_BLOCK_ID
; THINLINKBITCODE-NOT: BLOCKINFO_BLOCK
; THINLINKBITCODE-NOT: TYPE_BLOCK_ID
; THINLINKBITCODE-NOT: VSTOFFSET
; THINLINKBITCODE-NOT: CONSTANTS_BLOCK
; THINLINKBITCODE-NOT: METADATA_KIND_BLOCK
; THINLINKBITCODE-NOT: METADATA_BLOCK
; THINLINKBITCODE-NOT: OPERAND_BUNDLE_TAGS_BLOCK
; THINLINKBITCODE-NOT: UnknownBlock26
; THINLINKBITCODE-NOT: FUNCTION_BLOCK
; THINLINKBITCODE-NOT: VALUE_SYMTAB
; THINLINKBITCODE: MODULE_BLOCK
; THINLINKBITCODE: VERSION
; THINLINKBITCODE: SOURCE_FILENAME
; THINLINKBITCODE: GLOBALVAL_SUMMARY_BLOCK
; THINLINKBITCODE: HASH
; THINLINKBITCODE: SYMTAB_BLOCK
; THINLINKBITCODE: STRTAB_BLOCK
!llvm.dbg.cu = !{}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!llvm.module.flags = !{!1}