Skip to content

Commit 6cd3ef2

Browse files
authored
[Driver][SYCL] Fix issue with coverage and profile options for device (#12119)
The changes which prevent coverage and profile options from being used for device compilations had a problem with -fsanitize=address logic. We were allowing _any_ option that happened to have 'address' as an argument as a legal pass through. Adjust this exception to be specific to -fsanitize.
1 parent 74bf30a commit 6cd3ef2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,8 @@ SYCLToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
10881088
bool Unsupported = false;
10891089
for (OptSpecifier UnsupportedOpt : getUnsupportedOpts()) {
10901090
if (Opt.matches(UnsupportedOpt)) {
1091-
if (A->getValues().size() == 1) {
1091+
if (Opt.getID() == options::OPT_fsanitize_EQ &&
1092+
A->getValues().size() == 1) {
10921093
std::string SanitizeVal = A->getValue();
10931094
if (SanitizeVal == "address") {
10941095
if (IsNewDAL)

clang/test/Driver/sycl-unsupported.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
// RUN: -check-prefixes=UNSUPPORTED_OPT_DIAG,UNSUPPORTED_OPT
3636
// RUN: %clangxx -fsycl -forder-file-instrumentation -### %s 2>&1 \
3737
// RUN: | FileCheck %s -DARCH=spir64 -DOPT=-forder-file-instrumentation
38+
// Check to make sure our '-fsanitize=address' exception isn't triggered by a
39+
// different option
40+
// RUN: %clangxx -fsycl -fprofile-instr-generate=address -### %s 2>&1 \
41+
// RUN: | FileCheck %s -DARCH=spir64 -DOPT=-fprofile-instr-generate=address \
42+
// RUN: -DOPT_CC1=-fprofile-instrument=clang \
43+
// RUN: -check-prefixes=UNSUPPORTED_OPT_DIAG,UNSUPPORTED_OPT
3844

3945
// CHECK: ignoring '[[OPT]]' option as it is not currently supported for target '[[ARCH]]{{.*}}' [-Woption-ignored]
4046
// CHECK-NOT: clang{{.*}} "-fsycl-is-device"{{.*}} "[[OPT]]{{.*}}"

0 commit comments

Comments
 (0)