1 // -flto=thin causes a switch to llvm-bc object files.
2 // RUN: %clangxx -ccc-print-phases -nocudainc -nocudalib -c %s -flto=thin 2> %t
3 // RUN: FileCheck -check-prefix=CHECK-COMPILE-ACTIONS < %t %s
4 //
5 // CHECK-COMPILE-ACTIONS: 2: compiler, {1}, ir, (host-cuda)
6 // CHECK-COMPILE-ACTIONS-NOT: lto-bc
7 // CHECK-COMPILE-ACTIONS: 12: backend, {11}, lto-bc, (host-cuda)
8 
9 // RUN: %clangxx -ccc-print-phases -nocudainc -nocudalib %s -flto=thin 2> %t
10 // RUN: FileCheck -check-prefix=CHECK-COMPILELINK-ACTIONS < %t %s
11 //
12 // CHECK-COMPILELINK-ACTIONS: 0: input, "{{.*}}thinlto.cu", cuda, (host-cuda)
13 // CHECK-COMPILELINK-ACTIONS: 1: preprocessor, {0}, cuda-cpp-output
14 // CHECK-COMPILELINK-ACTIONS: 2: compiler, {1}, ir, (host-cuda)
15 // CHECK-COMPILELINK-ACTIONS: 3: input, "{{.*}}thinlto.cu", cuda, (device-cuda, sm_20)
16 // CHECK-COMPILELINK-ACTIONS: 4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_20)
17 // CHECK-COMPILELINK-ACTIONS: 5: compiler, {4}, ir, (device-cuda, sm_20)
18 // CHECK-COMPILELINK-ACTIONS: 6: backend, {5}, assembler, (device-cuda, sm_20)
19 // CHECK-COMPILELINK-ACTIONS: 7: assembler, {6}, object, (device-cuda, sm_20)
20 // CHECK-COMPILELINK-ACTIONS: 8: offload, "device-cuda (nvptx64-nvidia-cuda:sm_20)" {7}, object
21 // CHECK-COMPILELINK-ACTIONS: 9: offload, "device-cuda (nvptx64-nvidia-cuda:sm_20)" {6}, assembler
22 // CHECK-COMPILELINK-ACTIONS: 10: linker, {8, 9}, cuda-fatbin, (device-cuda)
23 // CHECK-COMPILELINK-ACTIONS: 11: offload, "host-cuda {{.*}}" {2}, "device-cuda{{.*}}" {10}, ir
24 // CHECK-COMPILELINK-ACTIONS: 12: backend, {11}, lto-bc, (host-cuda)
25 // CHECK-COMPILELINK-ACTIONS: 13: linker, {12}, image, (host-cuda)
26 
27 // -flto=thin should cause link using gold plugin with thinlto option,
28 // also confirm that it takes precedence over earlier -fno-lto and -flto=full.
29 // RUN: %clangxx -nocudainc -nocudalib \
30 // RUN:        -target x86_64-unknown-linux -### %s -flto=full -fno-lto -flto=thin 2> %t
31 // RUN: FileCheck -check-prefix=CHECK-LINK-THIN-ACTION < %t %s
32 //
33 // CHECK-LINK-THIN-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
34 // CHECK-LINK-THIN-ACTION: "-plugin-opt=thinlto"
35 
36 // Check that subsequent -flto=full takes precedence
37 // RUN: %clangxx -nocudainc -nocudalib \
38 // RUN:        -target x86_64-unknown-linux -### %s -flto=thin -flto=full 2> %t
39 // RUN: FileCheck -check-prefix=CHECK-LINK-FULL-ACTION < %t %s
40 //
41 // CHECK-LINK-FULL-ACTION: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
42 // CHECK-LINK-FULL-ACTION-NOT: "-plugin-opt=thinlto"
43 
44 // Check that subsequent -fno-lto takes precedence
45 // RUN: %clangxx -nocudainc -nocudalib \
46 // RUN:        -target x86_64-unknown-linux -### %s -flto=thin -fno-lto 2> %t
47 // RUN: FileCheck -check-prefix=CHECK-LINK-NOLTO-ACTION < %t %s
48 //
49 // CHECK-LINK-NOLTO-ACTION-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
50 // CHECK-LINK-NOLTO-ACTION-NOT: "-plugin-opt=thinlto"
51