Skip to content

[SYCL] Turn on -fsycl-id-queries-fit-in-int by default #3427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/LangOptions.def
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ LANGOPT(DeclareSPIRVBuiltins, 1, 0, "Declare SPIR-V builtin functions")
LANGOPT(SYCLExplicitSIMD , 1, 0, "SYCL compilation with explicit SIMD extension")
LANGOPT(EnableDAEInSpirKernels , 1, 0, "Enable Dead Argument Elimination in SPIR kernels")
LANGOPT(
SYCLValueFitInMaxInt, 1, 0,
SYCLValueFitInMaxInt, 1, 1,
"SYCL compiler assumes value fits within MAX_INT for member function of "
"get/operator[], get_id/operator[] and get_global_id/get_global_linear_id "
"in SYCL class id, iterm and nd_iterm")
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -2493,7 +2493,7 @@ def fsycl_instrument_device_code : Flag<["-"], "fsycl-instrument-device-code">,
HelpText<"Add ITT instrumentation intrinsics calls">,
MarshallingInfoFlag<CodeGenOpts<"SPIRITTAnnotations">>;
defm sycl_id_queries_fit_in_int: BoolFOption<"sycl-id-queries-fit-in-int",
LangOpts<"SYCLValueFitInMaxInt">, DefaultFalse,
LangOpts<"SYCLValueFitInMaxInt">, DefaultTrue,
PosFlag<SetTrue, [], "Assume">, NegFlag<SetFalse, [], "Do not assume">,
BothFlags<[CC1Option, CoreOption], " that SYCL ID queries fit within MAX_INT.">>;
def fsycl_use_bitcode : Flag<["-"], "fsycl-use-bitcode">,
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Preprocessor/sycl-macro.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -E -dM | FileCheck %s
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL-ID %s
// RUN: %clang_cc1 %s -fsycl-id-queries-fit-in-int -fsycl-is-host -sycl-std=2017 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
// RUN: %clang_cc1 %s -fsycl-id-queries-fit-in-int -fsycl-is-device -sycl-std=2017 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD %s
// RUN: %clang_cc1 %s -fsycl-id-queries-fit-in-int -fsycl-is-device -sycl-std=2020 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD-2020 %s
Expand Down Expand Up @@ -26,3 +27,4 @@
// CHECK-MSVC: #define __SYCL_ID_QUERIES_FIT_IN_INT__ 1

// CHECK-NO-SYCL_FIT_IN_INT-NOT:#define __SYCL_ID_QUERIES_FIT_IN_INT__ 1
// CHECK-SYCL-ID:#define __SYCL_ID_QUERIES_FIT_IN_INT__ 1