From c3d7a361772efa7e70bc256740d0f637e07a4f49 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Thu, 5 Jan 2017 16:52:11 +0000 Subject: [PATCH] [CUDA] Make CUDAInstallationDetector take the host triple in its constructor. Summary: Previously it was taking the true target triple, which is not really what it needs: The location of the CUDA installation depends on the host OS. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28319 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291130 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains.cpp | 6 +++--- lib/Driver/ToolChains.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index f15baa840d..8815c13201 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1805,7 +1805,7 @@ static CudaVersion ParseCudaVersionFile(llvm::StringRef V) { } CudaInstallationDetector::CudaInstallationDetector( - const Driver &D, const llvm::Triple &TargetTriple, + const Driver &D, const llvm::Triple &HostTriple, const llvm::opt::ArgList &Args) : D(D) { SmallVector CudaPathCandidates; @@ -1840,7 +1840,7 @@ CudaInstallationDetector::CudaInstallationDetector( // 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 (TargetTriple.isArch64Bit() && FS.exists(InstallPath + "/lib64")) + if (HostTriple.isArch64Bit() && FS.exists(InstallPath + "/lib64")) LibPath = InstallPath + "/lib64"; else if (FS.exists(InstallPath + "/lib")) LibPath = InstallPath + "/lib"; @@ -4870,7 +4870,7 @@ Tool *DragonFly::buildLinker() const { CudaToolChain::CudaToolChain(const Driver &D, const llvm::Triple &Triple, const ToolChain &HostTC, const ArgList &Args) : ToolChain(D, Triple, Args), HostTC(HostTC), - CudaInstallation(D, Triple, Args) { + CudaInstallation(D, HostTC.getTriple(), Args) { if (CudaInstallation.isValid()) getProgramPaths().push_back(CudaInstallation.getBinPath()); } diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h index e687222463..f43db7a24d 100644 --- a/lib/Driver/ToolChains.h +++ b/lib/Driver/ToolChains.h @@ -43,7 +43,7 @@ private: mutable llvm::SmallSet ArchsWithVersionTooLowErrors; public: - CudaInstallationDetector(const Driver &D, const llvm::Triple &Triple, + CudaInstallationDetector(const Driver &D, const llvm::Triple &HostTriple, const llvm::opt::ArgList &Args); void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, -- 2.40.0