1; Basic ThinLTO tests.
2; RUN: opt -module-summary %s -o %t1.o
3; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o
4
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
10
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
16
17; Test with all threads, on all cores, on all CPU sockets
18; RUN: rm -f %t31.lto.o %t32.lto.o
19; RUN: wasm-ld -r -save-temps --thinlto-jobs=all %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
22
23; Test with many more threads than the system has
24; RUN: rm -f %t31.lto.o %t32.lto.o
25; RUN: wasm-ld -r -save-temps --thinlto-jobs=1000 %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
28
29; Test with a bad value
30; RUN: rm -f %t31.lto.o %t32.lto.o
31; RUN: not wasm-ld -r -save-temps --thinlto-jobs=foo %t1.o %t2.o -o %t3 2>&1 | FileCheck %s --check-prefix=BAD-JOBS
32; BAD-JOBS: error: --thinlto-jobs: invalid job count: foo
33
34; Check without --thinlto-jobs (which currently defaults to heavyweight_hardware_concurrency, meanning one thread per hardware core -- not SMT)
35; RUN: rm -f %t31.lto.o %t32.lto.o
36; RUN: wasm-ld -r -save-temps %t1.o %t2.o -o %t3
37; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
38; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
39
40; NM1: T f
41; NM2: T g
42
43target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
44target triple = "wasm32-unknown-unknown"
45
46declare void @g(...)
47
48define void @f() {
49entry:
50  call void (...) @g()
51  ret void
52}
53