[PATCH] D28319: [CUDA] Make CUDAInstallationDetector take the host triple in its constructor.
Justin Lebar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 4 13:56:16 PST 2017
jlebar created this revision.
jlebar added a reviewer: tra.
jlebar added a subscriber: cfe-commits.
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.
https://reviews.llvm.org/D28319
Files:
clang/lib/Driver/ToolChains.cpp
clang/lib/Driver/ToolChains.h
Index: clang/lib/Driver/ToolChains.h
===================================================================
--- clang/lib/Driver/ToolChains.h
+++ clang/lib/Driver/ToolChains.h
@@ -43,7 +43,7 @@
mutable llvm::SmallSet<CudaArch, 4> 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,
Index: clang/lib/Driver/ToolChains.cpp
===================================================================
--- clang/lib/Driver/ToolChains.cpp
+++ clang/lib/Driver/ToolChains.cpp
@@ -1805,7 +1805,7 @@
}
CudaInstallationDetector::CudaInstallationDetector(
- const Driver &D, const llvm::Triple &TargetTriple,
+ const Driver &D, const llvm::Triple &HostTriple,
const llvm::opt::ArgList &Args)
: D(D) {
SmallVector<std::string, 4> CudaPathCandidates;
@@ -1840,7 +1840,7 @@
// 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 @@
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());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28319.83126.patch
Type: text/x-patch
Size: 1929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170104/d28fd823/attachment.bin>
More information about the cfe-commits
mailing list