| 1 |
// -flto causes a switch to llvm-bc object files. |
| 2 |
// RUN: %clangxx --target=x86_64-unknown-linux-gnu --no-offload-new-driver -nocudainc -nocudalib -ccc-print-phases -c %s -flto 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 --target=x86_64-unknown-linux-gnu --no-offload-new-driver -nocudainc -nocudalib -ccc-print-phases %s -flto 2> %t |
| 10 |
// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-ACTIONS < %t %s |
| 11 |
// |
| 12 |
// CHECK-COMPILELINK-ACTIONS: 0: input, "{{.*}}lto.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, "{{.*}}lto.cu", cuda, (device-cuda, sm_{{.*}}) |
| 16 |
// CHECK-COMPILELINK-ACTIONS: 4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_{{.*}}) |
| 17 |
// CHECK-COMPILELINK-ACTIONS: 5: compiler, {4}, ir, (device-cuda, sm_{{.*}}) |
| 18 |
// CHECK-COMPILELINK-ACTIONS: 6: backend, {5}, assembler, (device-cuda, sm_{{.*}}) |
| 19 |
// CHECK-COMPILELINK-ACTIONS: 7: assembler, {6}, object, (device-cuda, sm_{{.*}}) |
| 20 |
// CHECK-COMPILELINK-ACTIONS: 8: offload, "device-cuda (nvptx{{.*}}-nvidia-cuda:sm_{{.*}})" {7}, object |
| 21 |
// CHECK-COMPILELINK-ACTIONS: 9: offload, "device-cuda (nvptx{{.*}}-nvidia-cuda:sm_{{.*}})" {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 |
// llvm-bc and llvm-ll outputs need to match regular suffixes |
| 28 |
// (unfortunately). |
| 29 |
// RUN: %clangxx %s --target=x86_64-unknown-linux-gnu --no-offload-new-driver -nocudainc -nocudalib -flto -save-temps --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda -### 2> %t |
| 30 |
// RUN: FileCheck -check-prefix=CHECK-COMPILELINK-SUFFIXES < %t %s |
| 31 |
// |
| 32 |
// CHECK-COMPILELINK-SUFFIXES: "-o" "[[CPP:.*lto-host.*\.cui]]" "-x" "cuda" "{{.*}}lto.cu" |
| 33 |
// CHECK-COMPILELINK-SUFFIXES: "-o" "[[BC:.*lto-host.*\.bc]]" {{.*}}[[CPP]]" |
| 34 |
// CHECK-COMPILELINK-SUFFIXES: "-o" "[[OBJ:.*lto-host.*\.o]]" {{.*}}[[BC]]" |
| 35 |
// CHECK-COMPILELINK-SUFFIXES: "{{.*}}a.{{(out|exe)}}" {{.*}}[[OBJ]]" |
| 36 |
|
| 37 |
// RUN: %clangxx --target=x86_64-unknown-linux-gnu %s --no-offload-new-driver -nocudainc -nocudalib -flto -S -### 2> %t |
| 38 |
// RUN: FileCheck -check-prefix=CHECK-COMPILE-SUFFIXES < %t %s |
| 39 |
// |
| 40 |
// CHECK-COMPILE-SUFFIXES: "-o" "{{.*}}lto.s" "-x" "cuda" "{{.*}}lto.cu" |
| 41 |
|
| 42 |
// RUN: not %clangxx --target=x86_64-unknown-linux-gnu --no-offload-new-driver -nocudainc -nocudalib %s -emit-llvm 2>&1 \ |
| 43 |
// RUN: | FileCheck --check-prefix=LLVM-LINK %s |
| 44 |
// LLVM-LINK: -emit-llvm cannot be used when linking |
| 45 |
|
| 46 |
/// With ld.bfd or gold, link against LLVMgold. |
| 47 |
// RUN: %clangxx -nocudainc -nocudalib --target=x86_64-unknown-linux-gnu --offload-arch=sm_52 --sysroot=%S/Inputs/basic_cross_linux_tree %s \ |
| 48 |
// RUN: --no-offload-new-driver -fuse-ld=bfd -flto=thin -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s |
| 49 |
// RUN: %clangxx -nocudainc -nocudalib --target=x86_64-unknown-linux-gnu --offload-arch=sm_52 --sysroot=%S/Inputs/basic_cross_linux_tree %s \ |
| 50 |
// RUN: --no-offload-new-driver -fuse-ld=gold -flto=full -### 2>&1 | FileCheck --check-prefix=LLVMGOLD %s |
| 51 |
// |
| 52 |
// LLVMGOLD: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}" |
| 53 |
|
| 54 |
/// lld does not need LLVMgold. |
| 55 |
// RUN: %clangxx -nocudainc -nocudalib --target=x86_64-unknown-linux-gnu --offload-arch=sm_52 --sysroot=%S/Inputs/basic_cross_linux_tree %s \ |
| 56 |
// RUN: --no-offload-new-driver -fuse-ld=lld -flto=full -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s |
| 57 |
// RUN: %clangxx -nocudainc -nocudalib --target=x86_64-unknown-linux-gnu --offload-arch=sm_52 --sysroot=%S/Inputs/basic_cross_linux_tree %s \ |
| 58 |
// RUN: --no-offload-new-driver -fuse-ld=gold -flto=full -fno-lto -### 2>&1 | FileCheck --check-prefix=NO-LLVMGOLD %s |
| 59 |
// |
| 60 |
// NO-LLVMGOLD-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}" |
| 61 |
|
| 62 |
// -flto passes along an explicit debugger tuning argument. |
| 63 |
// RUN: %clangxx -nocudainc -nocudalib --no-offload-new-driver \ |
| 64 |
// RUN: --target=x86_64-unknown-linux -### %s -flto -glldb --offload-arch=sm_52 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2> %t |
| 65 |
// RUN: FileCheck -check-prefix=CHECK-TUNING-LLDB < %t %s |
| 66 |
// RUN: %clangxx -nocudainc -nocudalib --no-offload-new-driver \ |
| 67 |
// RUN: --target=x86_64-unknown-linux -### %s -flto -g --offload-arch=sm_52 --cuda-path=%S/Inputs/CUDA_80/usr/local/cuda 2> %t |
| 68 |
// RUN: FileCheck -check-prefix=CHECK-NO-TUNING < %t %s |
| 69 |
// |
| 70 |
// CHECK-TUNING-LLDB: "-plugin-opt=-debugger-tune=lldb" |
| 71 |
// CHECK-NO-TUNING-NOT: "-plugin-opt=-debugger-tune |