mirror of https://github.com/microsoft/clang.git
Rename -mlink-cuda-bitcode to -mlink-builtin-bitcode
The same semantics work for OpenCL, and probably any offload language. Keep the old name around as an alias. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340193 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b1704c4407
commit
fef69ae4fb
|
@ -287,9 +287,11 @@ def mconstructor_aliases : Flag<["-"], "mconstructor-aliases">,
|
|||
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<mlink_builtin_bitcode>;
|
||||
def vectorize_loops : Flag<["-"], "vectorize-loops">,
|
||||
HelpText<"Run the Loop vectorization passes">;
|
||||
def vectorize_slp : Flag<["-"], "vectorize-slp">,
|
||||
|
|
|
@ -621,7 +621,7 @@ void CudaToolChain::addClangTargetOptions(
|
|||
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 @@ void CudaToolChain::addClangTargetOptions(
|
|||
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;
|
||||
|
|
|
@ -912,10 +912,10 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
|
|||
Opts.RelaxELFRelocations = Args.hasArg(OPT_mrelax_relocations);
|
||||
Opts.DebugCompilationDir = Args.getLastArgValue(OPT_fdebug_compilation_dir);
|
||||
for (auto *A :
|
||||
Args.filtered(OPT_mlink_bitcode_file, OPT_mlink_cuda_bitcode)) {
|
||||
Args.filtered(OPT_mlink_bitcode_file, OPT_mlink_builtin_bitcode)) {
|
||||
CodeGenOptions::BitcodeFileToLink F;
|
||||
F.Filename = A->getValue();
|
||||
if (A->getOption().matches(OPT_mlink_cuda_bitcode)) {
|
||||
if (A->getOption().matches(OPT_mlink_builtin_bitcode)) {
|
||||
F.LinkFlags = llvm::Linker::Flags::LinkOnlyNeeded;
|
||||
// When linking CUDA bitcode, propagate function attributes so that
|
||||
// e.g. libdevice gets fast-math attrs if we're building with fast-math.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:}}
|
||||
|
||||
/// ###########################################################################
|
||||
|
|
Loading…
Reference in New Issue