1e0ca2ff0SJon Chesterfield; REQUIRES: x86
2851b1f86SBob Haarman; RUN: rm -fr %T/thinlto
3851b1f86SBob Haarman; RUN: mkdir %T/thinlto
4851b1f86SBob Haarman; RUN: opt -thinlto-bc -o %T/thinlto/main.obj %s
5851b1f86SBob Haarman; RUN: opt -thinlto-bc -o %T/thinlto/foo.obj %S/Inputs/lto-dep.ll
6851b1f86SBob Haarman; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj
7*91a6bfedSReid Kleckner; RUN: llvm-nm %T/thinlto/main.exe.lto.1.obj | FileCheck %s
8851b1f86SBob Haarman
909158252SAlexandre Ganea; Test various possible options for /opt:lldltojobs
1009158252SAlexandre Ganea; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj /opt:lldltojobs=1
11*91a6bfedSReid Kleckner; RUN: llvm-nm %T/thinlto/main.exe.lto.1.obj | FileCheck %s
1209158252SAlexandre Ganea; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj /opt:lldltojobs=all
13*91a6bfedSReid Kleckner; RUN: llvm-nm %T/thinlto/main.exe.lto.1.obj | FileCheck %s
14717a4608SHans Wennborg; RUN: lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj /opt:lldltojobs=100
15*91a6bfedSReid Kleckner; RUN: llvm-nm %T/thinlto/main.exe.lto.1.obj | FileCheck %s
1609158252SAlexandre Ganea; RUN: not lld-link /lldsavetemps /out:%T/thinlto/main.exe /entry:main /subsystem:console %T/thinlto/main.obj %T/thinlto/foo.obj /opt:lldltojobs=foo 2>&1 | FileCheck %s --check-prefix=BAD-JOBS
1709158252SAlexandre Ganea; BAD-JOBS: error: /opt:lldltojobs: invalid job count: foo
1809158252SAlexandre Ganea
19497c110eSevgeny; This command will store full path to foo.obj in the archive %t.lib
20497c110eSevgeny; Check that /lldsavetemps is still usable in such case.
21497c110eSevgeny; RUN: lld-link /lib %T/thinlto/foo.obj /out:%t.lib
22497c110eSevgeny; RUN: lld-link /lldsavetemps /out:%t.exe /entry:main /subsystem:console %T/thinlto/main.obj %t.lib
23497c110eSevgeny
24851b1f86SBob Haarman; CHECK-NOT: U foo
25851b1f86SBob Haarman
267b1d7937SAmy Huangtarget datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
27851b1f86SBob Haarmantarget triple = "x86_64-pc-windows-msvc"
28851b1f86SBob Haarman
29851b1f86SBob Haarmandefine i32 @main() {
30851b1f86SBob Haarman  call void @foo()
31851b1f86SBob Haarman  ret i32 0
32851b1f86SBob Haarman}
33851b1f86SBob Haarman
34851b1f86SBob Haarmandeclare void @foo()
35