2 ; RUN: opt -module-summary %s -o %t1.o
3 ; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o
5 ; First force single-threaded mode
6 ; RUN: rm -f %t31.lto.o %t32.lto.o
7 ; RUN: wasm-ld -r -save-temps --thinlto-jobs=1 %t1.o %t2.o -o %t3
8 ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
9 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
11 ; Next force multi-threaded mode
12 ; RUN: rm -f %t31.lto.o %t32.lto.o
13 ; RUN: wasm-ld -r -save-temps --thinlto-jobs=2 %t1.o %t2.o -o %t3
14 ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
15 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
17 ;; --thinlto-jobs= defaults to --threads=.
18 ; RUN: rm -f %t31.lto.o %t32.lto.o
19 ; RUN: wasm-ld -r -save-temps --threads=2 %t1.o %t2.o -o %t3
20 ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
21 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
23 ;; --thinlto-jobs= overrides --threads=.
24 ; RUN: rm -f %t31.lto.o %t32.lto.o
25 ; RUN: wasm-ld -r -save-temps --threads=1 --thinlto-jobs=2 %t1.o %t2.o -o %t3
26 ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
27 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
29 ; Test with all threads, on all cores, on all CPU sockets
30 ; RUN: rm -f %t31.lto.o %t32.lto.o
31 ; RUN: wasm-ld -r -save-temps --thinlto-jobs=all %t1.o %t2.o -o %t3
32 ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
33 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
35 ; Test with many more threads than the system has
36 ; RUN: rm -f %t31.lto.o %t32.lto.o
37 ; RUN: wasm-ld -r -save-temps --thinlto-jobs=100 %t1.o %t2.o -o %t3
38 ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
39 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
41 ; Test with a bad value
42 ; RUN: rm -f %t31.lto.o %t32.lto.o
43 ; RUN: not wasm-ld -r -save-temps --thinlto-jobs=foo %t1.o %t2.o -o %t3 2>&1 | FileCheck %s --check-prefix=BAD-JOBS
44 ; BAD-JOBS: error: --thinlto-jobs: invalid job count: foo
46 ; Check without --thinlto-jobs (which currently defaults to heavyweight_hardware_concurrency, meanning one thread per hardware core -- not SMT)
47 ; RUN: rm -f %t31.lto.o %t32.lto.o
48 ; RUN: wasm-ld -r -save-temps %t1.o %t2.o -o %t3
49 ; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
50 ; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
55 target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128"
56 target triple = "wasm32-unknown-unknown"