blob: d37d10bd356014ca132a0c116099480a43eaf331 [file] [log] [blame]
Teresa Johnson0c6a4ff2017-03-23 19:47:39 +00001; 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 Collingbourne1398a322016-12-16 00:26:30 +00008; RUN: not llvm-modextract -b -n 2 -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
Teresa Johnson0c6a4ff2017-03-23 19:47:39 +00009; RUN: llvm-dis -o - %t0.bc | FileCheck --check-prefix=M0 %s
10; RUN: llvm-dis -o - %t1.bc | FileCheck --check-prefix=M1 %s
11; RUN: llvm-dis -o - %t0.thinlink.bc | FileCheck --check-prefix=NODEBUG %s
12; RUN: llvm-dis -o - %t1.thinlink.bc | FileCheck --check-prefix=NODEBUG %s
13; RUN: llvm-bcanalyzer -dump %t0.bc | FileCheck --check-prefix=BCA0 %s
14; RUN: llvm-bcanalyzer -dump %t1.bc | FileCheck --check-prefix=BCA1 %s
15
16; Make sure the combined index files produced by both the normal and the
17; thin link bitcode files are identical
18; RUN: llvm-lto -thinlto -o %t3 %t0.bc
19; Copy the minimized bitcode to the regular bitcode path so the module
20; paths in the index are the same.
21; RUN: cp %t0.thinlink.bc %t0.bc
22; RUN: llvm-lto -thinlto -o %t4 %t0.bc
23; RUN: diff %t3.thinlto.bc %t4.thinlto.bc
Peter Collingbourne1398a322016-12-16 00:26:30 +000024
25; ERROR: llvm-modextract: error: module index out of range; bitcode file contains 2 module(s)
26
27; BCA0: <GLOBALVAL_SUMMARY_BLOCK
28; BCA1-NOT: <GLOBALVAL_SUMMARY_BLOCK
29
Peter Collingbourne20a00932017-01-18 20:03:02 +000030$g = comdat any
31
Peter Collingbourne1398a322016-12-16 00:26:30 +000032; M0: @g = external global i8{{$}}
Peter Collingbourne20a00932017-01-18 20:03:02 +000033; M1: @g = global i8 42, comdat, !type !0
34@g = global i8 42, comdat, !type !0
Peter Collingbourne1398a322016-12-16 00:26:30 +000035
36; M0: define i8* @f()
37; M1-NOT: @f()
38define i8* @f() {
39 ret i8* @g
40}
41
42; M1: !0 = !{i32 0, !"typeid"}
43!0 = !{i32 0, !"typeid"}
Peter Collingbourne28ffd322017-02-08 20:44:00 +000044
45; M0: !llvm.dbg.cu
46; M1-NOT: !llvm.dbg.cu
Teresa Johnson0c6a4ff2017-03-23 19:47:39 +000047; NODEBUG-NOT: !llvm.dbg.cu
Peter Collingbourne28ffd322017-02-08 20:44:00 +000048!llvm.dbg.cu = !{}
49
50!1 = !{i32 2, !"Debug Info Version", i32 3}
51!llvm.module.flags = !{!1}