diff options
author | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-10-16 13:31:30 +0000 |
---|---|---|
committer | Jonas Hahnfeld <hahnjo@hahnjo.de> | 2017-10-16 13:31:30 +0000 |
commit | 30b847df63031714b459d3c5278f9fd915dfa738 (patch) | |
tree | 8b124877215d67528416b28a06774f949be8f8b2 /lib/Driver/ToolChains/Cuda.cpp | |
parent | c49d6ee8203dd3376433a2c928dea15000073a8b (diff) |
[CUDA] Require libdevice only if needed
If the user passes -nocudalib, we can live without it being present.
Simplify the code by just checking whether LibDeviceMap is empty.
Differential Revision: https://reviews.llvm.org/D38901
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315902 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/Cuda.cpp')
-rw-r--r-- | lib/Driver/ToolChains/Cuda.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/lib/Driver/ToolChains/Cuda.cpp b/lib/Driver/ToolChains/Cuda.cpp index 349f9e4f51..4d040a204d 100644 --- a/lib/Driver/ToolChains/Cuda.cpp +++ b/lib/Driver/ToolChains/Cuda.cpp @@ -87,8 +87,7 @@ CudaInstallationDetector::CudaInstallationDetector( LibDevicePath = InstallPath + "/nvvm/libdevice"; auto &FS = D.getVFS(); - if (!(FS.exists(IncludePath) && FS.exists(BinPath) && - FS.exists(LibDevicePath))) + if (!(FS.exists(IncludePath) && FS.exists(BinPath))) continue; // On Linux, we have both lib and lib64 directories, and we need to choose @@ -167,17 +166,9 @@ CudaInstallationDetector::CudaInstallationDetector( } } - // This code prevents IsValid from being set when - // no libdevice has been found. - bool allEmpty = true; - std::string LibDeviceFile; - for (auto key : LibDeviceMap.keys()) { - LibDeviceFile = LibDeviceMap.lookup(key); - if (!LibDeviceFile.empty()) - allEmpty = false; - } - - if (allEmpty) + // Check that we have found at least one libdevice that we can link in if + // -nocudalib hasn't been specified. + if (LibDeviceMap.empty() && !Args.hasArg(options::OPT_nocudalib)) continue; IsValid = true; |