@@ -576,6 +576,29 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
576
576
}
577
577
};
578
578
579
+ addLibraries (SYCLDeviceWrapperLibs);
580
+ if (IsSpirvAOT)
581
+ addLibraries (SYCLDeviceFallbackLibs);
582
+
583
+ bool NativeBfloatLibs;
584
+ bool NeedBfloatLibs = selectBfloatLibs (TargetTriple, C, NativeBfloatLibs);
585
+ if (NeedBfloatLibs) {
586
+ // Add native or fallback bfloat16 library.
587
+ if (NativeBfloatLibs)
588
+ addLibraries (SYCLDeviceBfloat16NativeLib);
589
+ else
590
+ addLibraries (SYCLDeviceBfloat16FallbackLib);
591
+ }
592
+
593
+ // Link in ITT annotations library unless fsycl-no-instrument-device-code
594
+ // is specified. This ensures that we are ABI-compatible with the
595
+ // instrumented device code, which was the default not so long ago.
596
+ if (Args.hasFlag (options::OPT_fsycl_instrument_device_code,
597
+ options::OPT_fno_sycl_instrument_device_code, true ))
598
+ addLibraries (SYCLDeviceAnnotationLibs);
599
+
600
+ #if !defined(_WIN32)
601
+
579
602
auto addSingleLibrary = [&](const DeviceLibOptInfo &Lib) {
580
603
if (!DeviceLibLinkInfo[Lib.DeviceLibOption ])
581
604
return ;
@@ -636,28 +659,6 @@ SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
636
659
return JIT;
637
660
};
638
661
639
- addLibraries (SYCLDeviceWrapperLibs);
640
- if (IsSpirvAOT)
641
- addLibraries (SYCLDeviceFallbackLibs);
642
-
643
- bool NativeBfloatLibs;
644
- bool NeedBfloatLibs = selectBfloatLibs (TargetTriple, C, NativeBfloatLibs);
645
- if (NeedBfloatLibs) {
646
- // Add native or fallback bfloat16 library.
647
- if (NativeBfloatLibs)
648
- addLibraries (SYCLDeviceBfloat16NativeLib);
649
- else
650
- addLibraries (SYCLDeviceBfloat16FallbackLib);
651
- }
652
-
653
- // Link in ITT annotations library unless fsycl-no-instrument-device-code
654
- // is specified. This ensures that we are ABI-compatible with the
655
- // instrumented device code, which was the default not so long ago.
656
- if (Args.hasFlag (options::OPT_fsycl_instrument_device_code,
657
- options::OPT_fno_sycl_instrument_device_code, true ))
658
- addLibraries (SYCLDeviceAnnotationLibs);
659
-
660
- #if !defined(_WIN32)
661
662
std::string SanitizeVal;
662
663
size_t sanitizer_lib_idx = getSingleBuildTarget ();
663
664
if (Arg *A = Args.getLastArg (options::OPT_fsanitize_EQ,
0 commit comments