1; Test distributed build thin link output from llvm-lto2 2 3; Generate bitcode files with summary, as well as minimized bitcode without 4; the debug metadata for the thin link. 5; RUN: opt -thinlto-bc %s -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.bc 6; RUN: opt -thinlto-bc %p/Inputs/distributed_import.ll -thin-link-bitcode-file=%t2.thinlink.bc -o %t2.bc 7; RUN: llvm-bcanalyzer -dump %t1.thinlink.bc | FileCheck --check-prefix=THINLINKBITCODE %s 8 9; First perform the thin link on the normal bitcode file. 10; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ 11; RUN: -thinlto-distributed-indexes \ 12; RUN: -r=%t1.bc,g, \ 13; RUN: -r=%t1.bc,analias, \ 14; RUN: -r=%t1.bc,f,px \ 15; RUN: -r=%t2.bc,g,px \ 16; RUN: -r=%t2.bc,analias,px \ 17; RUN: -r=%t2.bc,aliasee,px 18; RUN: opt -function-import -import-all-index -enable-import-metadata -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out 19; RUN: opt -function-import -import-all-index -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out 20; RUN: llvm-dis -o - %t1.out | FileCheck %s --check-prefix=IMPORT 21; RUN: llvm-dis -o - %t2.out | FileCheck %s --check-prefix=EXPORT 22 23; Save the generated index files. 24; RUN: cp %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig 25; RUN: cp %t2.bc.thinlto.bc %t2.bc.thinlto.bc.orig 26 27; Copy the minimized bitcode to the regular bitcode path so the module 28; paths in the index are the same (save the regular bitcode for use again 29; further down). 30; RUN: cp %t1.bc %t1.bc.sv 31; RUN: cp %t1.thinlink.bc %t1.bc 32; RUN: cp %t2.bc %t2.bc.sv 33; RUN: cp %t2.thinlink.bc %t2.bc 34 35; Next perform the thin link on the minimized bitcode files, and compare dumps 36; of the resulting indexes to the above dumps to ensure they are identical. 37; RUN: rm -f %t1.bc.thinlto.bc %t2.bc.thinlto.bc 38; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ 39; RUN: -thinlto-distributed-indexes \ 40; RUN: -r=%t1.bc,g, \ 41; RUN: -r=%t1.bc,analias, \ 42; RUN: -r=%t1.bc,f,px \ 43; RUN: -r=%t2.bc,g,px \ 44; RUN: -r=%t2.bc,analias,px \ 45; RUN: -r=%t2.bc,aliasee,px 46; RUN: diff %t1.bc.thinlto.bc.orig %t1.bc.thinlto.bc 47; RUN: diff %t2.bc.thinlto.bc.orig %t2.bc.thinlto.bc 48 49; Make sure importing occurs as expected 50; RUN: cp %t1.bc.sv %t1.bc 51; RUN: cp %t2.bc.sv %t2.bc 52; RUN: opt -function-import -import-all-index -enable-import-metadata -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out 53; RUN: opt -function-import -import-all-index -summary-file %t2.bc.thinlto.bc %t2.bc -o %t2.out 54; RUN: llvm-dis -o - %t1.out | FileCheck %s --check-prefix=IMPORT 55; RUN: llvm-dis -o - %t2.out | FileCheck %s --check-prefix=EXPORT 56 57; IMPORT: define available_externally i32 @g() !thinlto_src_module 58; IMPORT: define available_externally void @analias() !thinlto_src_module 59; EXPORT: @G.llvm. 60 61target triple = "x86_64-unknown-linux-gnu" 62target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 63 64declare i32 @g(...) 65declare void @analias(...) 66 67define void @f() { 68entry: 69 call i32 (...) @g() 70 call void (...) @analias() 71 ret void 72} 73 74; THINLINKBITCODE-NOT: IDENTIFICATION_BLOCK_ID 75; THINLINKBITCODE-NOT: BLOCKINFO_BLOCK 76; THINLINKBITCODE-NOT: TYPE_BLOCK_ID 77; THINLINKBITCODE-NOT: VSTOFFSET 78; THINLINKBITCODE-NOT: CONSTANTS_BLOCK 79; THINLINKBITCODE-NOT: METADATA_KIND_BLOCK 80; THINLINKBITCODE-NOT: METADATA_BLOCK 81; THINLINKBITCODE-NOT: OPERAND_BUNDLE_TAGS_BLOCK 82; THINLINKBITCODE-NOT: UnknownBlock26 83; THINLINKBITCODE-NOT: FUNCTION_BLOCK 84; THINLINKBITCODE-NOT: VALUE_SYMTAB 85; THINLINKBITCODE: MODULE_BLOCK 86; THINLINKBITCODE: VERSION 87; THINLINKBITCODE: SOURCE_FILENAME 88; THINLINKBITCODE: GLOBALVAL_SUMMARY_BLOCK 89; THINLINKBITCODE: HASH 90; THINLINKBITCODE: SYMTAB_BLOCK 91; THINLINKBITCODE: STRTAB_BLOCK 92 93!llvm.dbg.cu = !{} 94 95!1 = !{i32 2, !"Debug Info Version", i32 3} 96!llvm.module.flags = !{!1} 97