1; REQUIRES: x86 2 3; Basic ThinLTO tests. 4; RUN: opt -module-summary %s -o %t1.o 5; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o 6 7; First force single-threaded mode 8; RUN: rm -f %t31.lto.o %t32.lto.o 9; RUN: ld.lld -save-temps --thinlto-jobs=1 -shared %t1.o %t2.o -o %t3 10; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 11; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 12 13; Next force multi-threaded mode 14; RUN: rm -f %t31.lto.o %t32.lto.o 15; RUN: ld.lld -save-temps --thinlto-jobs=2 -shared %t1.o %t2.o -o %t3 16; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 17; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 18 19;; --plugin-opt=jobs= is an alias. 20; RUN: rm -f %t31.lto.o %t32.lto.o 21; RUN: ld.lld -save-temps --plugin-opt=jobs=2 -shared %t1.o %t2.o -o %t3 22; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 23; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 24 25;; --thinlto-jobs= defaults to --threads=. 26; RUN: rm -f %t31.lto.o %t32.lto.o 27; RUN: ld.lld -save-temps --threads=2 -shared %t1.o %t2.o -o %t3 28; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 29; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 30 31;; --thinlto-jobs= overrides --threads=. 32; RUN: rm -f %t31.lto.o %t32.lto.o 33; RUN: ld.lld -save-temps --threads=1 --plugin-opt=jobs=2 -shared %t1.o %t2.o -o %t3 34; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 35; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 36 37; Test with all threads, on all cores, on all CPU sockets 38; RUN: rm -f %t31.lto.o %t32.lto.o 39; RUN: ld.lld -save-temps --thinlto-jobs=all -shared %t1.o %t2.o -o %t3 40; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 41; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 42 43; Test with many more threads than the system has 44; RUN: rm -f %t31.lto.o %t32.lto.o 45; RUN: ld.lld -save-temps --thinlto-jobs=100 -shared %t1.o %t2.o -o %t3 46; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 47; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 48 49; Test with a bad value 50; RUN: rm -f %t31.lto.o %t32.lto.o 51; RUN: not ld.lld -save-temps --thinlto-jobs=foo -shared %t1.o %t2.o -o %t3 2>&1 | FileCheck %s --check-prefix=BAD-JOBS 52; BAD-JOBS: error: --thinlto-jobs: invalid job count: foo 53 54; Then check without --thinlto-jobs (which currently defaults to heavyweight_hardware_concurrency, meanning one thread per hardware core -- not SMT) 55; RUN: ld.lld -shared -save-temps %t1.o %t2.o -o %t3 56; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1 57; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2 58 59; Check that -save-temps is usable with thin archives 60; RUN: rm -fr %t.dir 61; RUN: mkdir -p %t.dir 62; RUN: cp %t2.o %t.dir/t.o 63; RUN: llvm-ar rcsT %t.dir/t.a %t.dir/t.o 64; RUN: ld.lld -save-temps %t1.o %t.dir/t.a -o %t.null 65; RUN: ls %t.dir/t.a*.0.preopt.bc 66 67; NM1: T f 68; NM2: T g 69 70target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 71target triple = "x86_64-unknown-linux-gnu" 72 73declare void @g(...) 74 75define void @f() { 76entry: 77 call void (...) @g() 78 ret void 79} 80