@@ -1014,17 +1014,20 @@ RocmInstallationDetector::getCommonBitcodeLibs(
1014
1014
bool isOpenMP = false ) const {
1015
1015
llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12 > BCLibs;
1016
1016
1017
- auto GPUSanEnabled = [GPUSan]() { return std::get<bool >(GPUSan); };
1017
+ // GPU Sanitizer currently only supports ASan and is enabled through host
1018
+ // ASan.
1019
+ auto GPUSanEnabled = [GPUSan]() {
1020
+ return std::get<bool >(GPUSan) &&
1021
+ std::get<const SanitizerArgs>(GPUSan).needsAsanRt ();
1022
+ };
1018
1023
auto AddBCLib = [&](ToolChain::BitCodeLibraryInfo BCLib,
1019
1024
bool Internalize = true ) {
1020
1025
BCLib.ShouldInternalize = Internalize;
1021
1026
BCLibs.emplace_back (BCLib);
1022
1027
};
1023
1028
auto AddSanBCLibs = [&]() {
1024
1029
if (GPUSanEnabled ()) {
1025
- auto SanArgs = std::get<const SanitizerArgs>(GPUSan);
1026
- if (SanArgs.needsAsanRt ())
1027
- AddBCLib (getAsanRTLPath (), false );
1030
+ AddBCLib (getAsanRTLPath (), false );
1028
1031
}
1029
1032
};
1030
1033
@@ -1066,7 +1069,7 @@ ROCMToolChain::getCommonDeviceLibNames(const llvm::opt::ArgList &DriverArgs,
1066
1069
// them all?
1067
1070
std::tuple<bool , const SanitizerArgs> GPUSan (
1068
1071
DriverArgs.hasFlag (options::OPT_fgpu_sanitize,
1069
- options::OPT_fno_gpu_sanitize, false ),
1072
+ options::OPT_fno_gpu_sanitize, true ),
1070
1073
getSanitizerArgs (DriverArgs));
1071
1074
bool DAZ = DriverArgs.hasFlag (options::OPT_fgpu_flush_denormals_to_zero,
1072
1075
options::OPT_fno_gpu_flush_denormals_to_zero,
@@ -1099,7 +1102,7 @@ bool AMDGPUToolChain::shouldSkipSanitizeOption(
1099
1102
return false ;
1100
1103
1101
1104
if (!DriverArgs.hasFlag (options::OPT_fgpu_sanitize,
1102
- options::OPT_fno_gpu_sanitize, false ))
1105
+ options::OPT_fno_gpu_sanitize, true ))
1103
1106
return true ;
1104
1107
1105
1108
auto &Diags = TC.getDriver ().getDiags ();
0 commit comments