[clang] 4934127 - Diable sanitizer options for amdgpu
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 12:41:30 PDT 2020
Author: Yaxun (Sam) Liu
Date: 2020-09-10T15:41:07-04:00
New Revision: 4934127e627d7c58342be15bc9230a7cbdf5273f
URL: https://github.com/llvm/llvm-project/commit/4934127e627d7c58342be15bc9230a7cbdf5273f
DIFF: https://github.com/llvm/llvm-project/commit/4934127e627d7c58342be15bc9230a7cbdf5273f.diff
LOG: Diable sanitizer options for amdgpu
Currently AMDGPU does not support sanitizer. Disable
sanitizer options for now until they are supported.
Differential Revision: https://reviews.llvm.org/D87461
Added:
clang/test/Driver/hip-sanitize-options.hip
Modified:
clang/lib/Driver/SanitizerArgs.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index 0f51443010ca..0cb1e7b5282b 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -929,10 +929,10 @@ static bool hasTargetFeatureMTE(const llvm::opt::ArgStringList &CmdArgs) {
void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs,
types::ID InputType) const {
- // NVPTX doesn't currently support sanitizers. Bailing out here means that
- // e.g. -fsanitize=address applies only to host code, which is what we want
- // for now.
- if (TC.getTriple().isNVPTX())
+ // NVPTX/AMDGPU doesn't currently support sanitizers. Bailing out here means
+ // that e.g. -fsanitize=address applies only to host code, which is what we
+ // want for now.
+ if (TC.getTriple().isNVPTX() || TC.getTriple().isAMDGPU())
return;
// Translate available CoverageFeatures to corresponding clang-cc1 flags.
diff --git a/clang/test/Driver/hip-sanitize-options.hip b/clang/test/Driver/hip-sanitize-options.hip
new file mode 100644
index 000000000000..908e02136cad
--- /dev/null
+++ b/clang/test/Driver/hip-sanitize-options.hip
@@ -0,0 +1,9 @@
+// REQUIRES: clang-driver, x86-registered-target, amdgpu-registered-target
+
+// RUN: %clang -### -target x86_64-unknown-linux-gnu --offload-arch=gfx906 \
+// RUN: -fsanitize=address \
+// RUN: -nogpuinc -nogpulib \
+// RUN: %s 2>&1 | FileCheck %s
+
+// CHECK-NOT: {{"[^"]*clang[^"]*".* "-fcuda-is-device".* "-fsanitize=address"}}
+// CHECK: {{"[^"]*clang[^"]*".* "-triple" "x86_64-unknown-linux-gnu".* "-fsanitize=address"}}
More information about the cfe-commits
mailing list