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