@@ -6258,6 +6258,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
6258
6258
if (Args.hasFlag (options::OPT_fsycl_esimd, options::OPT_fno_sycl_esimd,
6259
6259
false ))
6260
6260
CmdArgs.push_back (" -fsycl-explicit-simd" );
6261
+
6262
+ if (!D.IsCLMode ()) {
6263
+ // SYCL library is guaranteed to work correctly only with dynamic
6264
+ // MSVC runtime.
6265
+ llvm::Triple AuxT = C.getDefaultToolChain ().getTriple ();
6266
+ if (Args.hasFlag (options::OPT_fsycl_device_only, OptSpecifier (), false ))
6267
+ AuxT = llvm::Triple (llvm::sys::getProcessTriple ());
6268
+ if (AuxT.isWindowsMSVCEnvironment ()) {
6269
+ CmdArgs.push_back (" -D_MT" );
6270
+ CmdArgs.push_back (" -D_DLL" );
6271
+ CmdArgs.push_back (" --dependent-lib=msvcrt" );
6272
+ }
6273
+ }
6261
6274
}
6262
6275
if (IsSYCLOffloadDevice && JA.getType () == types::TY_SYCL_Header) {
6263
6276
// Generating a SYCL Header
@@ -6275,20 +6288,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
6275
6288
CmdArgs.push_back (" -D__ENABLE_USM_ADDR_SPACE__" );
6276
6289
}
6277
6290
6278
- if ((IsSYCL || UseSYCLTriple) && !D.IsCLMode ()) {
6279
- // SYCL library is guaranteed to work correctly only with dynamic
6280
- // MSVC runtime.
6281
- llvm::Triple AuxT = C.getDefaultToolChain ().getTriple ();
6282
- if (Args.hasFlag (options::OPT_fsycl_device_only, OptSpecifier (), false ))
6283
- AuxT = llvm::Triple (llvm::sys::getProcessTriple ());
6284
- if (AuxT.isWindowsMSVCEnvironment ()) {
6285
- CmdArgs.push_back (" -D_MT" );
6286
- CmdArgs.push_back (" -D_DLL" );
6287
- if (IsSYCL && !IsSYCLOffloadDevice && SYCLDeviceInput)
6288
- CmdArgs.push_back (" --dependent-lib=msvcrt" );
6289
- }
6290
- }
6291
-
6292
6291
if (IsHIP)
6293
6292
CmdArgs.push_back (" -fcuda-allow-variadic-functions" );
6294
6293
0 commit comments