1; Basic ThinLTO tests. 2; RUN: rm -rf %t && mkdir %t && cd %t 3; RUN: mkdir d e 4 5; RUN: opt -module-summary %s -o a.o 6; RUN: opt -module-summary %p/Inputs/thinlto.ll -o d/b.o 7 8; First force single-threaded mode 9; RUN: rm -f out.lto.a.o d/out.lto.b.o 10; RUN: wasm-ld -r -save-temps --thinlto-jobs=1 a.o d/b.o -o e/out 11; RUN: llvm-nm out.lto.a.o | FileCheck %s --check-prefix=NM1 12; RUN: llvm-nm d/out.lto.b.o | FileCheck %s --check-prefix=NM2 13 14; Next force multi-threaded mode 15; RUN: rm -f out.lto.a.o d/out.lto.b.o 16; RUN: wasm-ld -r -save-temps --thinlto-jobs=2 a.o d/b.o -o e/out 17; RUN: llvm-nm out.lto.a.o | FileCheck %s --check-prefix=NM1 18; RUN: llvm-nm d/out.lto.b.o | FileCheck %s --check-prefix=NM2 19 20;; --thinlto-jobs= defaults to --threads=. 21; RUN: rm -f out.lto.a.o d/out.lto.b.o 22; RUN: wasm-ld -r -save-temps --threads=2 a.o d/b.o -o e/out 23; RUN: llvm-nm out.lto.a.o | FileCheck %s --check-prefix=NM1 24; RUN: llvm-nm d/out.lto.b.o | FileCheck %s --check-prefix=NM2 25 26;; --thinlto-jobs= overrides --threads=. 27; RUN: rm -f out.lto.a.o d/out.lto.b.o 28; RUN: wasm-ld -r -save-temps --threads=1 --thinlto-jobs=2 a.o d/b.o -o e/out 29; RUN: llvm-nm out.lto.a.o | FileCheck %s --check-prefix=NM1 30; RUN: llvm-nm d/out.lto.b.o | FileCheck %s --check-prefix=NM2 31 32; Test with all threads, on all cores, on all CPU sockets 33; RUN: rm -f out.lto.a.o d/out.lto.b.o 34; RUN: wasm-ld -r -save-temps --thinlto-jobs=all a.o d/b.o -o e/out 35; RUN: llvm-nm out.lto.a.o | FileCheck %s --check-prefix=NM1 36; RUN: llvm-nm d/out.lto.b.o | FileCheck %s --check-prefix=NM2 37 38; Test with many more threads than the system has 39; RUN: rm -f out.lto.a.o d/out.lto.b.o 40; RUN: wasm-ld -r -save-temps --thinlto-jobs=100 a.o d/b.o -o e/out 41; RUN: llvm-nm out.lto.a.o | FileCheck %s --check-prefix=NM1 42; RUN: llvm-nm d/out.lto.b.o | FileCheck %s --check-prefix=NM2 43 44; Test with a bad value 45; RUN: rm -f out.lto.a.o d/out.lto.b.o 46; RUN: not wasm-ld -r -save-temps --thinlto-jobs=foo a.o d/b.o -o e/out 2>&1 | FileCheck %s --check-prefix=BAD-JOBS 47; BAD-JOBS: error: --thinlto-jobs: invalid job count: foo 48 49; Check without --thinlto-jobs (which currently defaults to heavyweight_hardware_concurrency, meanning one thread per hardware core -- not SMT) 50; RUN: rm -f out.lto.a.o d/out.lto.b.o 51; RUN: wasm-ld -r -save-temps a.o d/b.o -o e/out 52; RUN: llvm-nm out.lto.a.o | FileCheck %s --check-prefix=NM1 53; RUN: llvm-nm d/out.lto.b.o | FileCheck %s --check-prefix=NM2 54 55; NM1: T f 56; NM2: T g 57 58target triple = "wasm32-unknown-unknown" 59 60declare void @g(...) 61 62define void @f() { 63entry: 64 call void (...) @g() 65 ret void 66} 67