[clang] 4921b0a - [clang][Driver][CUDA] Get rid of unused LibPath

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 01:36:50 PST 2023


Author: Kadir Cetinkaya
Date: 2023-01-12T10:36:43+01:00
New Revision: 4921b0a285ace77b7a3d5b9502b8602134daee0d

URL: https://github.com/llvm/llvm-project/commit/4921b0a285ace77b7a3d5b9502b8602134daee0d
DIFF: https://github.com/llvm/llvm-project/commit/4921b0a285ace77b7a3d5b9502b8602134daee0d.diff

LOG: [clang][Driver][CUDA] Get rid of unused LibPath

LibPath discovered during InstallationDetection wasn't used anywhere.
Moreover it actually resulted in discarding installations that don't have any
`/lib` directory.

This is causing troubles for our pipelines downstream, that want to perform
syntax-only analysis on the sources.

Differential Revision: https://reviews.llvm.org/D141467

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Cuda.cpp
    clang/lib/Driver/ToolChains/Cuda.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
index 5b4ed08b82144..76f4da2a704d0 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -194,19 +194,6 @@ CudaInstallationDetector::CudaInstallationDetector(
     if (CheckLibDevice && !FS.exists(LibDevicePath))
       continue;
 
-    // On Linux, we have both lib and lib64 directories, and we need to choose
-    // based on our triple.  On MacOS, we have only a lib directory.
-    //
-    // It's sufficient for our purposes to be flexible: If both lib and lib64
-    // exist, we choose whichever one matches our triple.  Otherwise, if only
-    // lib exists, we use it.
-    if (HostTriple.isArch64Bit() && FS.exists(InstallPath + "/lib64"))
-      LibPath = InstallPath + "/lib64";
-    else if (FS.exists(InstallPath + "/lib"))
-      LibPath = InstallPath + "/lib";
-    else
-      continue;
-
     Version = CudaVersion::UNKNOWN;
     if (auto CudaHFile = FS.getBufferForFile(InstallPath + "/include/cuda.h"))
       Version = parseCudaHFile((*CudaHFile)->getBuffer());

diff  --git a/clang/lib/Driver/ToolChains/Cuda.h b/clang/lib/Driver/ToolChains/Cuda.h
index b4770d2a0e440..8ee99d4a3786b 100644
--- a/clang/lib/Driver/ToolChains/Cuda.h
+++ b/clang/lib/Driver/ToolChains/Cuda.h
@@ -31,7 +31,6 @@ class CudaInstallationDetector {
   CudaVersion Version = CudaVersion::UNKNOWN;
   std::string InstallPath;
   std::string BinPath;
-  std::string LibPath;
   std::string LibDevicePath;
   std::string IncludePath;
   llvm::StringMap<std::string> LibDeviceMap;
@@ -69,8 +68,6 @@ class CudaInstallationDetector {
   StringRef getBinPath() const { return BinPath; }
   /// Get the detected Cuda Include path.
   StringRef getIncludePath() const { return IncludePath; }
-  /// Get the detected Cuda library path.
-  StringRef getLibPath() const { return LibPath; }
   /// Get the detected Cuda device library path.
   StringRef getLibDevicePath() const { return LibDevicePath; }
   /// Get libdevice file for given architecture


        


More information about the cfe-commits mailing list