@@ -182,11 +182,9 @@ const char *SYCLInstallationDetector::findLibspirvPath(
182182 const SmallString<64 > Basename =
183183 getLibSpirvBasename (DeviceTriple, HostTriple);
184184 auto searchAt = [&](StringRef Path, const Twine &a = " " , const Twine &b = " " ,
185- const Twine &c = " " , const Twine &d = " " ,
186- const Twine &e = " " ) -> const char * {
185+ const Twine &c = " " ) -> const char * {
187186 SmallString<128 > LibraryPath (Path);
188- llvm::sys::path::append (LibraryPath, a, b, c, d);
189- llvm::sys::path::append (LibraryPath, e, Basename);
187+ llvm::sys::path::append (LibraryPath, a, b, c, Basename);
190188
191189 if (Args.hasArgNoClaim (options::OPT__HASH_HASH_HASH) ||
192190 llvm::sys::fs::exists (LibraryPath))
@@ -195,14 +193,15 @@ const char *SYCLInstallationDetector::findLibspirvPath(
195193 return nullptr ;
196194 };
197195
198- // Otherwise, assume libclc is installed at the same prefix as clang
199- // Expected path w/out install.
200- if (const char *R = searchAt (D. ResourceDir , " .. " , " .. " , " clc" ))
201- return R;
196+ for ( const auto &IC : InstallationCandidates) {
197+ // Expected path w/out install.
198+ if (const char *R = searchAt (IC , " lib " , " clc" ))
199+ return R;
202200
203- // Expected path w/ install.
204- if (const char *R = searchAt (D.ResourceDir , " .." , " .." , " .." , " share" , " clc" ))
205- return R;
201+ // Expected path w/ install.
202+ if (const char *R = searchAt (IC, " share" , " clc" ))
203+ return R;
204+ }
206205
207206 return nullptr ;
208207}
@@ -838,7 +837,7 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
838837 addSingleLibrary (SYCLDeviceTsanLibs[sanitizer_lib_idx]);
839838#endif
840839
841- if (isSYCLNativeCPU ( TargetTriple))
840+ if (TargetTriple. isNativeCPU ( ))
842841 addLibraries (SYCLNativeCpuDeviceLibs);
843842
844843 return LibraryList;
@@ -1016,7 +1015,7 @@ const char *SYCL::Linker::constructLLVMLinkCommand(
10161015 const bool IsNVPTX = this ->getToolChain ().getTriple ().isNVPTX ();
10171016 const bool IsAMDGCN = this ->getToolChain ().getTriple ().isAMDGCN ();
10181017 const bool IsSYCLNativeCPU =
1019- isSYCLNativeCPU ( this ->getToolChain ().getTriple ());
1018+ this ->getToolChain ().getTriple (). isNativeCPU ( );
10201019 StringRef LibPostfix = " .bc" ;
10211020 StringRef NewLibPostfix = " .new.o" ;
10221021 if (HostTC->getTriple ().isWindowsMSVCEnvironment () &&
@@ -1160,7 +1159,7 @@ void SYCL::Linker::ConstructJob(Compilation &C, const JobAction &JA,
11601159 assert ((getToolChain ().getTriple ().isSPIROrSPIRV () ||
11611160 getToolChain ().getTriple ().isNVPTX () ||
11621161 getToolChain ().getTriple ().isAMDGCN () ||
1163- isSYCLNativeCPU ( getToolChain ().getTriple ())) &&
1162+ getToolChain ().getTriple (). isNativeCPU ( )) &&
11641163 " Unsupported target" );
11651164
11661165 std::string SubArchName =
@@ -1552,7 +1551,7 @@ static ArrayRef<options::ID> getUnsupportedOpts() {
15521551// Currently supported options by SYCL NativeCPU device compilation
15531552static inline bool SupportedByNativeCPU (const llvm::Triple &Triple,
15541553 const OptSpecifier &Opt) {
1555- if (!isSYCLNativeCPU ( Triple))
1554+ if (!Triple. isNativeCPU ( ))
15561555 return false ;
15571556
15581557 switch (Opt.getID ()) {
@@ -2001,7 +2000,7 @@ Tool *SYCLToolChain::buildBackendCompiler() const {
20012000}
20022001
20032002Tool *SYCLToolChain::buildLinker () const {
2004- assert (getTriple ().isSPIROrSPIRV () || isSYCLNativeCPU ( getTriple ()));
2003+ assert (getTriple ().isSPIROrSPIRV () || getTriple (). isNativeCPU ( ));
20052004 return new tools::SYCL::Linker (*this );
20062005}
20072006
0 commit comments