Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 1 | ; Generate bitcode files with summary, as well as minimized bitcode without |
| 2 | ; the debug metadata for the thin link. |
| 3 | ; RUN: opt -thinlto-bc -thin-link-bitcode-file=%t2 -o %t %s |
| 4 | ; RUN: llvm-modextract -b -n 0 -o %t0.bc %t |
| 5 | ; RUN: llvm-modextract -b -n 1 -o %t1.bc %t |
| 6 | ; RUN: llvm-modextract -b -n 0 -o %t0.thinlink.bc %t2 |
| 7 | ; RUN: llvm-modextract -b -n 1 -o %t1.thinlink.bc %t2 |
Peter Collingbourne | 1398a32 | 2016-12-16 00:26:30 +0000 | [diff] [blame] | 8 | ; RUN: not llvm-modextract -b -n 2 -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 9 | ; RUN: llvm-dis -o - %t0.bc | FileCheck --check-prefix=M0 %s |
| 10 | ; RUN: llvm-dis -o - %t1.bc | FileCheck --check-prefix=M1 %s |
Teresa Johnson | 0c6a4ff | 2017-03-23 19:47:39 +0000 | [diff] [blame] | 11 | ; RUN: llvm-bcanalyzer -dump %t0.bc | FileCheck --check-prefix=BCA0 %s |
| 12 | ; RUN: llvm-bcanalyzer -dump %t1.bc | FileCheck --check-prefix=BCA1 %s |
| 13 | |
| 14 | ; Make sure the combined index files produced by both the normal and the |
| 15 | ; thin link bitcode files are identical |
| 16 | ; RUN: llvm-lto -thinlto -o %t3 %t0.bc |
| 17 | ; Copy the minimized bitcode to the regular bitcode path so the module |
| 18 | ; paths in the index are the same. |
| 19 | ; RUN: cp %t0.thinlink.bc %t0.bc |
| 20 | ; RUN: llvm-lto -thinlto -o %t4 %t0.bc |
| 21 | ; RUN: diff %t3.thinlto.bc %t4.thinlto.bc |
Peter Collingbourne | 1398a32 | 2016-12-16 00:26:30 +0000 | [diff] [blame] | 22 | |
| 23 | ; ERROR: llvm-modextract: error: module index out of range; bitcode file contains 2 module(s) |
| 24 | |
| 25 | ; BCA0: <GLOBALVAL_SUMMARY_BLOCK |
Peter Collingbourne | e357fbd | 2017-06-08 23:01:49 +0000 | [diff] [blame] | 26 | ; BCA1: <FULL_LTO_GLOBALVAL_SUMMARY_BLOCK |
| 27 | ; 16 = not eligible to import |
| 28 | ; BCA1: <PERMODULE_GLOBALVAR_INIT_REFS {{.*}} op1=16 |
Peter Collingbourne | 1398a32 | 2016-12-16 00:26:30 +0000 | [diff] [blame] | 29 | ; BCA1-NOT: <GLOBALVAL_SUMMARY_BLOCK |
| 30 | |
Peter Collingbourne | 20a0093 | 2017-01-18 20:03:02 +0000 | [diff] [blame] | 31 | $g = comdat any |
| 32 | |
Peter Collingbourne | 1398a32 | 2016-12-16 00:26:30 +0000 | [diff] [blame] | 33 | ; M0: @g = external global i8{{$}} |
Peter Collingbourne | 20a0093 | 2017-01-18 20:03:02 +0000 | [diff] [blame] | 34 | ; M1: @g = global i8 42, comdat, !type !0 |
| 35 | @g = global i8 42, comdat, !type !0 |
Peter Collingbourne | 1398a32 | 2016-12-16 00:26:30 +0000 | [diff] [blame] | 36 | |
| 37 | ; M0: define i8* @f() |
| 38 | ; M1-NOT: @f() |
| 39 | define i8* @f() { |
| 40 | ret i8* @g |
| 41 | } |
| 42 | |
| 43 | ; M1: !0 = !{i32 0, !"typeid"} |
| 44 | !0 = !{i32 0, !"typeid"} |