2017-07-19 02:40:50 +08:00
|
|
|
; REQUIRES: x86
|
2018-05-03 05:40:07 +08:00
|
|
|
|
2016-10-11 02:12:53 +08:00
|
|
|
; Basic ThinLTO tests.
|
2018-05-12 03:37:08 +08:00
|
|
|
; RUN: opt -module-summary %s -o %t1.o
|
2016-10-11 07:56:13 +08:00
|
|
|
; RUN: opt -module-summary %p/Inputs/thinlto.ll -o %t2.o
|
2018-05-04 04:13:38 +08:00
|
|
|
|
2016-10-11 02:12:53 +08:00
|
|
|
; First force single-threaded mode
|
2018-05-12 03:37:08 +08:00
|
|
|
; RUN: rm -f %t31.lto.o %t32.lto.o
|
|
|
|
; RUN: ld.lld -save-temps --thinlto-jobs=1 -shared %t1.o %t2.o -o %t3
|
|
|
|
; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
|
|
|
|
; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
|
2016-10-11 02:12:53 +08:00
|
|
|
|
|
|
|
; Next force multi-threaded mode
|
2018-05-12 03:37:08 +08:00
|
|
|
; RUN: rm -f %t31.lto.o %t32.lto.o
|
|
|
|
; RUN: ld.lld -save-temps --thinlto-jobs=2 -shared %t1.o %t2.o -o %t3
|
|
|
|
; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
|
|
|
|
; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
|
2016-10-11 02:12:53 +08:00
|
|
|
|
2020-03-28 02:35:02 +08:00
|
|
|
;; --plugin-opt=jobs= is an alias.
|
|
|
|
; RUN: rm -f %t31.lto.o %t32.lto.o
|
|
|
|
; RUN: ld.lld -save-temps --plugin-opt=jobs=2 -shared %t1.o %t2.o -o %t3
|
|
|
|
; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
|
|
|
|
; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
|
|
|
|
|
[lld][COFF][ELF][WebAssembly] Replace --[no-]threads /threads[:no] with --threads={1,2,...} /threads:{1,2,...}
--no-threads is a name copied from gold.
gold has --no-thread, --thread-count and several other --thread-count-*.
There are needs to customize the number of threads (running several lld
processes concurrently or customizing the number of LTO threads).
Having a single --threads=N is a straightforward replacement of gold's
--no-threads + --thread-count.
--no-threads is used rarely. So just delete --no-threads instead of
keeping it for compatibility for a while.
If --threads= is specified (ELF,wasm; COFF /threads: is similar),
--thinlto-jobs= defaults to --threads=,
otherwise all available hardware threads are used.
There is currently no way to override a --threads={1,2,...}. It is still
a debate whether we should use --threads=all.
Reviewed By: rnk, aganea
Differential Revision: https://reviews.llvm.org/D76885
2020-03-18 03:40:19 +08:00
|
|
|
;; --thinlto-jobs= defaults to --threads=.
|
|
|
|
; RUN: rm -f %t31.lto.o %t32.lto.o
|
|
|
|
; RUN: ld.lld -save-temps --threads=2 -shared %t1.o %t2.o -o %t3
|
|
|
|
; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
|
|
|
|
; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
|
|
|
|
|
|
|
|
;; --thinlto-jobs= overrides --threads=.
|
|
|
|
; RUN: rm -f %t31.lto.o %t32.lto.o
|
|
|
|
; RUN: ld.lld -save-temps --threads=1 --plugin-opt=jobs=2 -shared %t1.o %t2.o -o %t3
|
|
|
|
; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
|
|
|
|
; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
|
|
|
|
|
2020-03-27 22:20:39 +08:00
|
|
|
; Test with all threads, on all cores, on all CPU sockets
|
|
|
|
; RUN: rm -f %t31.lto.o %t32.lto.o
|
|
|
|
; RUN: ld.lld -save-temps --thinlto-jobs=all -shared %t1.o %t2.o -o %t3
|
|
|
|
; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
|
|
|
|
; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
|
|
|
|
|
|
|
|
; Test with many more threads than the system has
|
|
|
|
; RUN: rm -f %t31.lto.o %t32.lto.o
|
2020-04-07 15:52:12 +08:00
|
|
|
; RUN: ld.lld -save-temps --thinlto-jobs=100 -shared %t1.o %t2.o -o %t3
|
2020-03-27 22:20:39 +08:00
|
|
|
; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
|
|
|
|
; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
|
|
|
|
|
|
|
|
; Test with a bad value
|
|
|
|
; RUN: rm -f %t31.lto.o %t32.lto.o
|
|
|
|
; RUN: not ld.lld -save-temps --thinlto-jobs=foo -shared %t1.o %t2.o -o %t3 2>&1 | FileCheck %s --check-prefix=BAD-JOBS
|
|
|
|
; BAD-JOBS: error: --thinlto-jobs: invalid job count: foo
|
|
|
|
|
|
|
|
; Then check without --thinlto-jobs (which currently defaults to heavyweight_hardware_concurrency, meanning one thread per hardware core -- not SMT)
|
|
|
|
; RUN: ld.lld -shared -save-temps %t1.o %t2.o -o %t3
|
2018-05-30 07:32:49 +08:00
|
|
|
; RUN: llvm-nm %t31.lto.o | FileCheck %s --check-prefix=NM1
|
|
|
|
; RUN: llvm-nm %t32.lto.o | FileCheck %s --check-prefix=NM2
|
2018-05-09 06:37:57 +08:00
|
|
|
|
2020-03-04 17:46:31 +08:00
|
|
|
; Check that -save-temps is usable with thin archives
|
|
|
|
; RUN: rm -fr %t.dir
|
|
|
|
; RUN: mkdir -p %t.dir
|
|
|
|
; RUN: cp %t2.o %t.dir/t.o
|
|
|
|
; RUN: llvm-ar rcsT %t.dir/t.a %t.dir/t.o
|
2020-03-04 21:39:58 +08:00
|
|
|
; RUN: ld.lld -save-temps %t1.o %t.dir/t.a -o %t.null
|
2020-05-12 13:39:59 +08:00
|
|
|
; RUN: ls %t.dir/t.a*.0.preopt.bc
|
2020-03-04 17:46:31 +08:00
|
|
|
|
2018-05-03 05:40:07 +08:00
|
|
|
; NM1: T f
|
|
|
|
; NM2: T g
|
|
|
|
|
2019-09-11 07:15:38 +08:00
|
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
2016-10-11 02:12:53 +08:00
|
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
|
|
|
|
declare void @g(...)
|
|
|
|
|
|
|
|
define void @f() {
|
|
|
|
entry:
|
|
|
|
call void (...) @g()
|
|
|
|
ret void
|
|
|
|
}
|