@@ -781,18 +781,10 @@ Driver::OpenMPRuntimeKind Driver::getOpenMPRuntime(const ArgList &Args) const {
781781 return RT;
782782}
783783
784- static const char *getDefaultSYCLArch (Compilation &C) {
785- // If -fsycl is supplied we will assume SPIR-V
786- if (C.getDefaultToolChain ().getTriple ().isArch32Bit ())
787- return " spirv32" ;
788- return " spirv64" ;
789- }
790-
791784static llvm::Triple getSYCLDeviceTriple (StringRef TargetArch) {
792785 SmallVector<StringRef, 5 > SYCLAlias = {" spir" , " spir64" , " spirv" , " spirv32" ,
793786 " spirv64" };
794- if (std::find (SYCLAlias.begin (), SYCLAlias.end (), TargetArch) !=
795- SYCLAlias.end ()) {
787+ if (llvm::is_contained (SYCLAlias, TargetArch)) {
796788 llvm::Triple TargetTriple;
797789 TargetTriple.setArchName (TargetArch);
798790 TargetTriple.setVendor (llvm::Triple::UnknownVendor);
@@ -811,7 +803,9 @@ static bool addSYCLDefaultTriple(Compilation &C,
811803 return false ;
812804 }
813805 // Add the default triple as it was not found.
814- llvm::Triple DefaultTriple = getSYCLDeviceTriple (getDefaultSYCLArch (C));
806+ llvm::Triple DefaultTriple = getSYCLDeviceTriple (
807+ C.getDefaultToolChain ().getTriple ().isArch32Bit () ? " spirv32"
808+ : " spirv64" );
815809 SYCLTriples.insert (SYCLTriples.begin (), DefaultTriple);
816810 return true ;
817811}
@@ -1028,9 +1022,6 @@ void Driver::CreateOffloadingDeviceToolChains(Compilation &C,
10281022 return ;
10291023 }
10301024
1031- //
1032- // SYCL
1033- //
10341025 // We need to generate a SYCL toolchain if the user specified -fsycl.
10351026 bool IsSYCL = C.getInputArgs ().hasFlag (options::OPT_fsycl,
10361027 options::OPT_fno_sycl, false );
@@ -6680,17 +6671,10 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
66806671 break ;
66816672 }
66826673 case Action::OFK_SYCL:
6683- switch (Target.getArch ()) {
6684- case llvm::Triple::spir:
6685- case llvm::Triple::spir64:
6686- case llvm::Triple::spirv32:
6687- case llvm::Triple::spirv64:
6674+ if (Target.isSPIROrSPIRV ())
66886675 TC = std::make_unique<toolchains::SYCLToolChain>(*this , Target, HostTC,
66896676 Args);
6690- break ;
6691- default :
6692- break ;
6693- }
6677+ break ;
66946678 default :
66956679 break ;
66966680 }
0 commit comments