1 // Check that we enable LTO-mode properly with '-fopenmp-target-jit' and that it 2 // still enabled LTO-mode if `-fno-offload-lto` is on. 3 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-phases -fopenmp=libomp \ 4 // RUN: -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-target-jit %s 2>&1 \ 5 // RUN: | FileCheck -check-prefix=PHASES-JIT %s 6 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-phases -fopenmp=libomp \ 7 // RUN: -fopenmp-targets=nvptx64-nvidia-cuda -foffload-lto -fopenmp-target-jit %s 2>&1 \ 8 // RUN: | FileCheck -check-prefix=PHASES-JIT %s 9 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-phases -fopenmp=libomp \ 10 // RUN: -fopenmp-targets=amdgcn-amd-amdhsa -fopenmp-target-jit %s 2>&1 \ 11 // RUN: | FileCheck -check-prefix=PHASES-JIT %s 12 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-phases -fopenmp=libomp \ 13 // RUN: -fopenmp-targets=amdgcn-amd-amdhsa -foffload-lto -fopenmp-target-jit %s 2>&1 \ 14 // RUN: | FileCheck -check-prefix=PHASES-JIT %s 15 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-phases -fopenmp=libomp \ 16 // RUN: -fopenmp-targets=amdgcn-amd-amdhsa -fno-offload-lto -fopenmp-target-jit %s 2>&1 \ 17 // RUN: | FileCheck -check-prefix=PHASES-JIT %s 18 // 19 // PHASES-JIT: 0: input, "[[INPUT:.+]]", c, (host-openmp) 20 // PHASES-JIT-NEXT: 1: preprocessor, {0}, cpp-output, (host-openmp) 21 // PHASES-JIT-NEXT: 2: compiler, {1}, ir, (host-openmp) 22 // PHASES-JIT-NEXT: 3: input, "[[INPUT]]", c, (device-openmp) 23 // PHASES-JIT-NEXT: 4: preprocessor, {3}, cpp-output, (device-openmp) 24 // PHASES-JIT-NEXT: 5: compiler, {4}, ir, (device-openmp) 25 // PHASES-JIT-NEXT: 6: offload, "host-openmp (x86_64-unknown-linux-gnu)" {2}, "device-openmp ([[TARGET:.+]])" {5}, ir 26 // PHASES-JIT-NEXT: 7: backend, {6}, lto-bc, (device-openmp) 27 // PHASES-JIT-NEXT: 8: offload, "device-openmp ([[TARGET]])" {7}, lto-bc 28 // PHASES-JIT-NEXT: 9: clang-offload-packager, {8}, image, (device-openmp) 29 // PHASES-JIT-NEXT: 10: offload, "host-openmp (x86_64-unknown-linux-gnu)" {2}, "device-openmp (x86_64-unknown-linux-gnu)" {9}, ir 30 // PHASES-JIT-NEXT: 11: backend, {10}, assembler, (host-openmp) 31 // PHASES-JIT-NEXT: 12: assembler, {11}, object, (host-openmp) 32 // PHASES-JIT-NEXT: 13: clang-linker-wrapper, {12}, image, (host-openmp) 33 34 // Check that we add the `--embed-bitcode` flag to the linker wrapper. 35 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp \ 36 // RUN: --cuda-path=%S/Inputs/CUDA_111/usr/local/cuda \ 37 // RUN: -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target -march=sm_52 \ 38 // RUN: -fopenmp-target-jit %s 2>&1 | FileCheck -check-prefix=LINKER %s 39 // LINKER: clang-linker-wrapper"{{.*}}"--embed-bitcode" 40 41 // Check for incompatible combinations 42 43 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp -fno-offload-lto \ 44 // RUN: -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-target-jit %s 2>&1 \ 45 // RUN: | FileCheck -check-prefix=NO-LTO %s 46 // NO-LTO: error: the combination of '-fno-offload-lto' and '-fopenmp-target-jit' is incompatible 47 48 // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -fopenmp=libomp -foffload-lto=thin \ 49 // RUN: -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-target-jit %s 2>&1 \ 50 // RUN: | FileCheck -check-prefix=THIN-LTO %s 51 // THIN-LTO: error: the combination of '-foffload-lto=' and '-fopenmp-target-jit' is incompatible 52