Index: include/clang/Driver/CC1Options.td =================================================================== --- include/clang/Driver/CC1Options.td +++ include/clang/Driver/CC1Options.td @@ -287,9 +287,13 @@ HelpText<"Emit complete constructors and destructors as aliases when possible">; def mlink_bitcode_file : Separate<["-"], "mlink-bitcode-file">, HelpText<"Link the given bitcode file before performing optimizations.">; -def mlink_cuda_bitcode : Separate<["-"], "mlink-cuda-bitcode">, + +def mlink_builtin_bitcode : Separate<["-"], "mlink-builtin-bitcode">, HelpText<"Link and internalize needed symbols from the given bitcode file " "before performing optimizations.">; +def mlink_cuda_bitcode : Separate<["-"], "mlink-cuda-bitcode">, + Alias; + def vectorize_loops : Flag<["-"], "vectorize-loops">, HelpText<"Run the Loop vectorization passes">; def vectorize_slp : Flag<["-"], "vectorize-slp">, Index: lib/Driver/ToolChains/Cuda.cpp =================================================================== --- lib/Driver/ToolChains/Cuda.cpp +++ lib/Driver/ToolChains/Cuda.cpp @@ -621,7 +621,7 @@ return; } - CC1Args.push_back("-mlink-cuda-bitcode"); + CC1Args.push_back("-mlink-builtin-bitcode"); CC1Args.push_back(DriverArgs.MakeArgString(LibDeviceFile)); // Libdevice in CUDA-7.0 requires PTX version that's more recent than LLVM @@ -667,7 +667,7 @@ SmallString<128> LibOmpTargetFile(LibraryPath); llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName); if (llvm::sys::fs::exists(LibOmpTargetFile)) { - CC1Args.push_back("-mlink-cuda-bitcode"); + CC1Args.push_back("-mlink-builtin-bitcode"); CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile)); FoundBCLibrary = true; break; Index: test/CodeGenCUDA/link-device-bitcode.cu =================================================================== --- test/CodeGenCUDA/link-device-bitcode.cu +++ test/CodeGenCUDA/link-device-bitcode.cu @@ -11,13 +11,19 @@ // // Make sure function in device-code gets linked in and internalized. // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \ +// RUN: -mlink-builtin-bitcode %t.bc -emit-llvm \ +// RUN: -disable-llvm-passes -o - %s \ +// RUN: | FileCheck %s -check-prefix CHECK-IR + +// Make sure legacy flag name works +// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \ // RUN: -mlink-cuda-bitcode %t.bc -emit-llvm \ // RUN: -disable-llvm-passes -o - %s \ // RUN: | FileCheck %s -check-prefix CHECK-IR // // Make sure we can link two bitcode files. // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \ -// RUN: -mlink-cuda-bitcode %t.bc -mlink-cuda-bitcode %t-2.bc \ +// RUN: -mlink-builtin-bitcode %t.bc -mlink-builtin-bitcode %t-2.bc \ // RUN: -emit-llvm -disable-llvm-passes -o - %s \ // RUN: | FileCheck %s -check-prefix CHECK-IR -check-prefix CHECK-IR-2 // @@ -30,7 +36,7 @@ // // Make sure NVVMReflect pass is enabled in NVPTX back-end. // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \ -// RUN: -mlink-cuda-bitcode %t.bc -S -o /dev/null %s \ +// RUN: -mlink-builtin-bitcode %t.bc -S -o /dev/null %s \ // RUN: -mllvm -debug-pass=Structure 2>&1 \ // RUN: | FileCheck %s -check-prefix CHECK-REFLECT Index: test/CodeGenCUDA/propagate-metadata.cu =================================================================== --- test/CodeGenCUDA/propagate-metadata.cu +++ test/CodeGenCUDA/propagate-metadata.cu @@ -1,5 +1,5 @@ // Check that when we link a bitcode module into a file using -// -mlink-cuda-bitcode, we apply the same attributes to the functions in that +// -mlink-builtin-bitcode, we apply the same attributes to the functions in that // bitcode module as we apply to functions we generate. // // In particular, we check that ftz and unsafe-math are propagated into the @@ -14,17 +14,17 @@ // RUN: %clang_cc1 -x c++ -emit-llvm-bc -ftrapping-math -DLIB \ // RUN: %s -o %t.bc -triple nvptx-unknown-unknown -// RUN: %clang_cc1 -x cuda %s -emit-llvm -mlink-cuda-bitcode %t.bc -o - \ +// RUN: %clang_cc1 -x cuda %s -emit-llvm -mlink-builtin-bitcode %t.bc -o - \ // RUN: -fno-trapping-math -fcuda-is-device -triple nvptx-unknown-unknown \ // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=NOFTZ --check-prefix=NOFAST -// RUN: %clang_cc1 -x cuda %s -emit-llvm -mlink-cuda-bitcode %t.bc \ +// RUN: %clang_cc1 -x cuda %s -emit-llvm -mlink-builtin-bitcode %t.bc \ // RUN: -fno-trapping-math -fcuda-flush-denormals-to-zero -o - \ // RUN: -fcuda-is-device -triple nvptx-unknown-unknown \ // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=FTZ \ // RUN: --check-prefix=NOFAST -// RUN: %clang_cc1 -x cuda %s -emit-llvm -mlink-cuda-bitcode %t.bc \ +// RUN: %clang_cc1 -x cuda %s -emit-llvm -mlink-builtin-bitcode %t.bc \ // RUN: -fno-trapping-math -fcuda-flush-denormals-to-zero -o - \ // RUN: -fcuda-is-device -menable-unsafe-fp-math -triple nvptx-unknown-unknown \ // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=FAST Index: test/Driver/cuda-detect.cu =================================================================== --- test/Driver/cuda-detect.cu +++ test/Driver/cuda-detect.cu @@ -145,8 +145,8 @@ // COMMON: "-triple" "nvptx-nvidia-cuda" // COMMON-SAME: "-fcuda-is-device" -// LIBDEVICE-SAME: "-mlink-cuda-bitcode" -// NOLIBDEVICE-NOT: "-mlink-cuda-bitcode" +// LIBDEVICE-SAME: "-mlink-builtin-bitcode" +// NOLIBDEVICE-NOT: "-mlink-builtin-bitcode" // LIBDEVICE20-SAME: libdevice.compute_20.10.bc // LIBDEVICE30-SAME: libdevice.compute_30.10.bc // LIBDEVICE35-SAME: libdevice.compute_35.10.bc Index: test/Driver/openmp-offload-gpu.c =================================================================== --- test/Driver/openmp-offload-gpu.c +++ test/Driver/openmp-offload-gpu.c @@ -152,7 +152,7 @@ // RUN: -fopenmp-relocatable-target -save-temps -no-canonical-prefixes %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHK-BCLIB %s -// CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-cuda-bitcode{{.*}}libomptarget-nvptx-sm_20.bc +// CHK-BCLIB: clang{{.*}}-triple{{.*}}nvptx64-nvidia-cuda{{.*}}-mlink-builtin-bitcode{{.*}}libomptarget-nvptx-sm_20.bc // CHK-BCLIB-NOT: {{error:|warning:}} /// ###########################################################################