1; Test InProcessThinLTO thin link output from llvm-lto2 2; Partially copied from distributed_import.ll, and added checks for {dis|en}abling imports 3 4; RUN: rm -f %t1.bc.thinlto.bc %t2.bc.thinlto.bc %t.out.1 %t.out.2 %t1.bc.imports %t2.bc.imports 5 6; Generate bitcode files with summary, as well as minimized bitcode containing just the summary 7; RUN: opt -thinlto-bc %s -thin-link-bitcode-file=%t1.thinlink.bc -o %t1.bc 8; RUN: opt -thinlto-bc %p/Inputs/distributed_import.ll -thin-link-bitcode-file=%t2.thinlink.bc -o %t2.bc 9 10; First perform the thin link on the normal bitcode file using 11; -thinlto-distributed-indexes, collecting outputs to be compared with later. 12; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ 13; RUN: -thinlto-distributed-indexes \ 14; RUN: -thinlto-emit-imports \ 15; RUN: -r=%t1.bc,g, \ 16; RUN: -r=%t1.bc,analias, \ 17; RUN: -r=%t1.bc,f,px \ 18; RUN: -r=%t2.bc,g,px \ 19; RUN: -r=%t2.bc,analias,px \ 20; RUN: -r=%t2.bc,aliasee,px 21; RUN: mv %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig 22; RUN: mv %t2.bc.thinlto.bc %t2.bc.thinlto.bc.orig 23; RUN: mv %t1.bc.imports %t1.bc.imports.orig 24; RUN: mv %t2.bc.imports %t2.bc.imports.orig 25 26; Now use -thinlto-emit-indexes instead. 27; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ 28; RUN: -thinlto-emit-indexes \ 29; RUN: -r=%t1.bc,g, \ 30; RUN: -r=%t1.bc,analias, \ 31; RUN: -r=%t1.bc,f,px \ 32; RUN: -r=%t2.bc,g,px \ 33; RUN: -r=%t2.bc,analias,px \ 34; RUN: -r=%t2.bc,aliasee,px \ 35; RUN: -o=%t.out 36 37; Since InProcessThinLTO ran, there should be output 38; RUN: ls %t.out.1 39; RUN: ls %t.out.2 40 41; Ensure imports weren't generated since -thinlto-emit-imports wasn't specified 42; RUN: not ls %t1.bc.imports 43; RUN: not ls %t2.bc.imports 44 45; Compare the generated index files. 46; RUN: diff %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig 47; RUN: diff %t2.bc.thinlto.bc %t2.bc.thinlto.bc.orig 48 49; RUN: rm -f %t1.bc.thinlto.bc %t2.bc.thinlto.bc %t.out.1 %t.out.2 50 51; Do the thin link again but also emit imports files now 52; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ 53; RUN: -thinlto-emit-indexes \ 54; RUN: -thinlto-emit-imports \ 55; RUN: -r=%t1.bc,g, \ 56; RUN: -r=%t1.bc,analias, \ 57; RUN: -r=%t1.bc,f,px \ 58; RUN: -r=%t2.bc,g,px \ 59; RUN: -r=%t2.bc,analias,px \ 60; RUN: -r=%t2.bc,aliasee,px \ 61; RUN: -o=%t.out 62 63; Check the output 64; RUN: ls %t.out.1 65; RUN: ls %t.out.2 66; RUN: diff %t1.bc.thinlto.bc %t1.bc.thinlto.bc.orig 67; RUN: diff %t2.bc.thinlto.bc %t2.bc.thinlto.bc.orig 68; RUN: diff %t1.bc.imports %t1.bc.imports.orig 69; RUN: diff %t2.bc.imports %t2.bc.imports.orig 70 71target triple = "x86_64-unknown-linux-gnu" 72target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 73 74declare i32 @g(...) 75declare void @analias(...) 76 77define void @f() { 78entry: 79 call i32 (...) @g() 80 call void (...) @analias() 81 ret void 82} 83 84!llvm.dbg.cu = !{} 85 86!1 = !{i32 2, !"Debug Info Version", i32 3} 87!llvm.module.flags = !{!1} 88