| 1 |
REQUIRES: x86 |
| 2 |
|
| 3 |
## Test that the LLD options /lldsavetemps and -thinlto-emit-imports-files |
| 4 |
## function correctly with DTLTO we also check that index files |
| 5 |
## (-thinlto-emit-index-files) are not emitted with DTLTO. |
| 6 |
|
| 7 |
RUN: rm -rf %t && split-file %s %t && cd %t |
| 8 |
|
| 9 |
RUN: sed 's/@t1/@t2/g' t1.ll > t2.ll |
| 10 |
|
| 11 |
## Generate ThinLTO bitcode files. Note that t3.bc will not be used by the |
| 12 |
## linker. |
| 13 |
RUN: opt -thinlto-bc t1.ll -o t1.bc |
| 14 |
RUN: opt -thinlto-bc t2.ll -o t2.bc |
| 15 |
RUN: cp t1.bc t3.bc |
| 16 |
|
| 17 |
## Generate object files for mock.py to return. |
| 18 |
RUN: llc t1.ll --filetype=obj -o t1.obj |
| 19 |
RUN: llc t2.ll --filetype=obj -o t2.obj |
| 20 |
|
| 21 |
## Create response file containing shared ThinLTO linker arguments. |
| 22 |
## -start-lib/-end-lib is used to test the special case where unused lazy |
| 23 |
## bitcode inputs result in empty index/imports files. |
| 24 |
## Note that mock.py does not do any compilation; instead, it simply writes |
| 25 |
## the contents of the object files supplied on the command line into the |
| 26 |
## output object files in job order. |
| 27 |
RUN: echo "/entry:t1 /subsystem:console \ |
| 28 |
RUN: t1.bc t2.bc -start-lib t3.bc -end-lib /out:my.exe \ |
| 29 |
RUN: -thinlto-distributor:\"%python\" \ |
| 30 |
RUN: -thinlto-distributor-arg:\"%llvm_src_root/utils/dtlto/mock.py\" \ |
| 31 |
RUN: -thinlto-distributor-arg:t1.obj \ |
| 32 |
RUN: -thinlto-distributor-arg:t2.obj \ |
| 33 |
RUN: -thinlto-remote-compiler:fake.exe" > l.rsp |
| 34 |
|
| 35 |
## Check that without extra flags, no index/imports files are produced and |
| 36 |
## backend temp files are removed. |
| 37 |
RUN: lld-link @l.rsp |
| 38 |
RUN: ls | FileCheck %s \ |
| 39 |
RUN: --check-prefixes=NOBACKEND,NOOTHERS |
| 40 |
|
| 41 |
## Check that with /lldsavetemps and -thinlto-emit-imports-files backend |
| 42 |
## tempoary files are retained and no index/imports files are produced. |
| 43 |
RUN: rm -f *.imports *.thinlto.bc |
| 44 |
RUN: lld-link @l.rsp /lldsavetemps -thinlto-emit-imports-files |
| 45 |
RUN: ls | sort | FileCheck %s \ |
| 46 |
RUN: --check-prefixes=BACKEND,NOOTHERS |
| 47 |
|
| 48 |
## JSON jobs description, retained with --save-temps. |
| 49 |
## Note that DTLTO temporary files include a PID component. |
| 50 |
NOBACKEND-NOT: {{^}}my.[[#]].dist-file.json{{$}} |
| 51 |
BACKEND: {{^}}my.[[#]].dist-file.json{{$}} |
| 52 |
|
| 53 |
## Index/imports files for t1.bc. |
| 54 |
NOOTHERS-NOT: {{^}}t1.bc.imports{{$}} |
| 55 |
NOOTHERS-NOT: {{^}}t1.bc.thinlto.bc{{$}} |
| 56 |
|
| 57 |
## Index/imports files for t2.bc. |
| 58 |
NOOTHERS-NOT: {{^}}t2.bc.imports{{$}} |
| 59 |
NOOTHERS-NOT: {{^}}t2.bc.thinlto.bc{{$}} |
| 60 |
|
| 61 |
## Empty index/imports files for unused t3.bc. |
| 62 |
NOOTHERS-NOT: {{^}}t3.bc.imports{{$}} |
| 63 |
NOOTHERS-NOT: {{^}}t3.bc.thinlto.bc{{$}} |
| 64 |
|
| 65 |
#--- t1.ll |
| 66 |
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 67 |
target triple = "x86_64-pc-windows-msvc" |
| 68 |
|
| 69 |
define void @t1() { |
| 70 |
ret void |
| 71 |
} |