Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 1 | ; Test distributed build thin link output from llvm-lto2 |
Teresa Johnson | 0515fb8 | 2016-11-03 01:07:16 +0000 | [diff] [blame] | 2 | |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 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 |
Haojie Wang | 1dec57d | 2017-07-21 17:25:20 +0000 | [diff] [blame] | 7 | ; RUN: llvm-bcanalyzer -dump %t1.thinlink.bc | FileCheck --check-prefix=THINLINKBITCODE %s |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 8 | |
| 9 | ; First perform the thin link on the normal bitcode file. |
Peter Collingbourne | 7faa60c | 2017-04-11 18:12:00 +0000 | [diff] [blame] | 10 | ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ |
Teresa Johnson | 0515fb8 | 2016-11-03 01:07:16 +0000 | [diff] [blame] | 11 | ; RUN: -thinlto-distributed-indexes \ |
| 12 | ; RUN: -r=%t1.bc,g, \ |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 13 | ; RUN: -r=%t1.bc,analias, \ |
Teresa Johnson | 0515fb8 | 2016-11-03 01:07:16 +0000 | [diff] [blame] | 14 | ; RUN: -r=%t1.bc,f,px \ |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 15 | ; RUN: -r=%t2.bc,g,px \ |
| 16 | ; RUN: -r=%t2.bc,analias,px \ |
| 17 | ; RUN: -r=%t2.bc,aliasee,px |
Teresa Johnson | 160f4bb | 2017-12-16 01:35:36 +0000 | [diff] [blame] | 18 | ; RUN: opt -function-import -import-all-index -enable-import-metadata -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 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 |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 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 |
Peter Collingbourne | 7faa60c | 2017-04-11 18:12:00 +0000 | [diff] [blame] | 38 | ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 39 | ; RUN: -thinlto-distributed-indexes \ |
| 40 | ; RUN: -r=%t1.bc,g, \ |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 41 | ; RUN: -r=%t1.bc,analias, \ |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 42 | ; RUN: -r=%t1.bc,f,px \ |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 43 | ; RUN: -r=%t2.bc,g,px \ |
| 44 | ; RUN: -r=%t2.bc,analias,px \ |
| 45 | ; RUN: -r=%t2.bc,aliasee,px |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 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 |
Teresa Johnson | 4358a40 | 2017-12-16 01:00:48 +0000 | [diff] [blame] | 52 | ; RUN: opt -function-import -import-all-index -enable-import-metadata -summary-file %t1.bc.thinlto.bc %t1.bc -o %t1.out |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 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 |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 56 | |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 57 | ; IMPORT: define available_externally i32 @g() !thinlto_src_module |
| 58 | ; IMPORT: define available_externally void @analias() !thinlto_src_module |
| 59 | ; EXPORT: @G.llvm. |
Teresa Johnson | 0515fb8 | 2016-11-03 01:07:16 +0000 | [diff] [blame] | 60 | |
Vitaly Buka | a5376f3 | 2017-12-16 02:10:00 +0000 | [diff] [blame] | 61 | target triple = "x86_64-unknown-linux-gnu" |
Amy Huang | 7b1d793 | 2019-09-10 23:15:38 +0000 | [diff] [blame] | 62 | target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
Davide Italiano | 2ceb628 | 2016-12-14 21:57:04 +0000 | [diff] [blame] | 63 | |
Teresa Johnson | 0515fb8 | 2016-11-03 01:07:16 +0000 | [diff] [blame] | 64 | declare i32 @g(...) |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 65 | declare void @analias(...) |
Teresa Johnson | 0515fb8 | 2016-11-03 01:07:16 +0000 | [diff] [blame] | 66 | |
| 67 | define void @f() { |
| 68 | entry: |
| 69 | call i32 (...) @g() |
Teresa Johnson | 81bbf74 | 2017-12-16 00:18:12 +0000 | [diff] [blame] | 70 | call void (...) @analias() |
Teresa Johnson | 0515fb8 | 2016-11-03 01:07:16 +0000 | [diff] [blame] | 71 | ret void |
| 72 | } |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 73 | |
Haojie Wang | 1dec57d | 2017-07-21 17:25:20 +0000 | [diff] [blame] | 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 | |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 93 | !llvm.dbg.cu = !{} |
| 94 | |
| 95 | !1 = !{i32 2, !"Debug Info Version", i32 3} |
| 96 | !llvm.module.flags = !{!1} |