Skip to content
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

[SYCL] Remove support of deprecated {121, 1.2.1, sycl-1.2.1, 2017} values for the sycl-std= argument #14544

Merged
merged 4 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -8461,7 +8461,7 @@ def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>,
Flags<[NoArgumentUnused]>,
Visibility<[ClangOption, CC1Option, CLOption]>,
HelpText<"SYCL language standard to compile for.">,
Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
Values<"2020">,
ShouldParseIf<!strconcat(fsycl_is_device.KeyPath, "||", fsycl_is_host.KeyPath)>;

def fsycl_default_sub_group_size
Expand Down
3 changes: 0 additions & 3 deletions clang/lib/Basic/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ std::string getClangFullCPPVersion() {

llvm::SmallVector<std::pair<llvm::StringRef, llvm::StringRef>, 2>
getSYCLVersionMacros(const LangOptions &LangOpts) {
if (LangOpts.getSYCLVersion() == LangOptions::SYCL_2017)
return {{"CL_SYCL_LANGUAGE_VERSION", "121"},
{"SYCL_LANGUAGE_VERSION", "201707"}};
if (LangOpts.getSYCLVersion() == LangOptions::SYCL_2020)
return {{"SYCL_LANGUAGE_VERSION", "202001"}};
llvm_unreachable("SYCL standard should be set");
Expand Down
7 changes: 0 additions & 7 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5509,13 +5509,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-D__INTEL_PREVIEW_BREAKING_CHANGES");

if (SYCLStdArg) {
// Use of -sycl-std=1.2.1 is deprecated. Emit a diagnostic stating so.
// TODO: remove support at next approprate major release.
StringRef StdValue(SYCLStdArg->getValue());
if (StdValue == "1.2.1" || StdValue == "121" ||
StdValue == "sycl-1.2.1" || StdValue == "2017")
D.Diag(diag::warn_drv_deprecated_argument_option_release)
<< StdValue << SYCLStdArg->getSpelling();
SYCLStdArg->render(Args, CmdArgs);
CmdArgs.push_back("-fsycl-std-layout-kernel-params");
} else {
Expand Down
5 changes: 0 additions & 5 deletions clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3805,9 +3805,6 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions &Opts,

if (Opts.isSYCL()) {
switch (Opts.SYCLVersion) {
case LangOptions::SYCL_2017:
GenerateArg(Consumer, OPT_sycl_std_EQ, "2017");
break;
case LangOptions::SYCL_2020:
GenerateArg(Consumer, OPT_sycl_std_EQ, "2020");
break;
Expand Down Expand Up @@ -4013,8 +4010,6 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.setSYCLVersion(
llvm::StringSwitch<LangOptions::SYCLMajorVersion>(A->getValue())
.Case("2020", LangOptions::SYCL_2020)
.Cases("2017", "121", "1.2.1", "sycl-1.2.1",
LangOptions::SYCL_2017)
.Default(LangOptions::SYCL_None));

if (Opts.SYCLVersion == LangOptions::SYCL_None)
Expand Down
22 changes: 0 additions & 22 deletions clang/test/Driver/sycl-deprecated.cpp

This file was deleted.

3 changes: 1 addition & 2 deletions clang/test/Preprocessor/sycl-macro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// 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 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD-2020 %s
// RUN: %clang_cc1 %s -fsycl-id-queries-fit-in-int -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD-2020 %s
// RUN: %clang_cc1 %s -fsycl-id-queries-fit-in-int -fsycl-is-device -sycl-std=1.2.1 -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD-DEVICE %s
// RUN: %clang_cc1 %s -fsycl-id-queries-fit-in-int -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL-STD-DEVICE %s
// RUNx: %clang_cc1 %s -fsycl-id-queries-fit-in-int -fsycl-is-device -E -dM -fms-compatibility | FileCheck --check-prefix=CHECK-MSVC %s
// RUN: %clang_cc1 -fno-sycl-id-queries-fit-in-int %s -E -dM | FileCheck \
// RUN: --check-prefix=CHECK-NO-SYCL_FIT_IN_INT %s
Expand All @@ -13,7 +13,6 @@

// CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
// CHECK-NOT:#define SYCL_EXTERNAL
// CHECK-NOT:#define CL_SYCL_LANGUAGE_VERSION 121
// CHECK-NOT:#define __SYCL_ID_QUERIES_FIT_IN_INT__ 1

// CHECK-SYCL-STD:#define SYCL_LANGUAGE_VERSION 202001
Expand Down
82 changes: 0 additions & 82 deletions clang/unittests/Frontend/CompilerInvocationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,23 +599,6 @@ TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagNotPresent) {
ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std="))));
}

TEST_F(CommandLineTest, ConditionalParsingIfFalseFlagPresent) {
const char *Args[] = {"-sycl-std=2017"};

CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);

ASSERT_FALSE(Diags->hasErrorOccurred());
ASSERT_FALSE(Invocation.getLangOpts().SYCLIsDevice);
ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_None);

Invocation.generateCC1CommandLine(GeneratedArgs, *this);

ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl-is-device"))));
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl-is-host"))));
ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std="))));
}

TEST_F(CommandLineTest, ConditionalParsingIfNonsenseSyclStdArg) {
const char *Args[] = {"-fsycl-is-device", "-sycl-std=garbage"};

Expand All @@ -633,57 +616,6 @@ TEST_F(CommandLineTest, ConditionalParsingIfNonsenseSyclStdArg) {
ASSERT_THAT(GeneratedArgs, Not(Contains(HasSubstr("-sycl-std="))));
}

TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg1) {
const char *Args[] = {"-fsycl-is-device", "-sycl-std=121"};

CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);

ASSERT_FALSE(Diags->hasErrorOccurred());
ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);

Invocation.generateCC1CommandLine(GeneratedArgs, *this);

ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl-is-device")));
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl-is-host"))));
ASSERT_THAT(GeneratedArgs, Contains(HasSubstr("-sycl-std=2017")));
}

TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg2) {
const char *Args[] = {"-fsycl-is-device", "-sycl-std=1.2.1"};

CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);

ASSERT_FALSE(Diags->hasErrorOccurred());
ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);

Invocation.generateCC1CommandLine(GeneratedArgs, *this);

ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl-is-device")));
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl-is-host"))));
ASSERT_THAT(GeneratedArgs, Contains(HasSubstr("-sycl-std=2017")));
}

TEST_F(CommandLineTest, ConditionalParsingIfOddSyclStdArg3) {
const char *Args[] = {"-fsycl-is-device", "-sycl-std=sycl-1.2.1"};

CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);

ASSERT_FALSE(Diags->hasErrorOccurred());
ASSERT_TRUE(Invocation.getLangOpts().SYCLIsDevice);
ASSERT_FALSE(Invocation.getLangOpts().SYCLIsHost);
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);

Invocation.generateCC1CommandLine(GeneratedArgs, *this);

ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl-is-device")));
ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fsycl-is-host"))));
ASSERT_THAT(GeneratedArgs, Contains(HasSubstr("-sycl-std=2017")));
}

TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresentHost) {
const char *Args[] = {"-fsycl-is-host"};

Expand Down Expand Up @@ -714,20 +646,6 @@ TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagNotPresentDevice) {
ASSERT_THAT(GeneratedArgs, Contains(HasSubstr("-sycl-std=")));
}

TEST_F(CommandLineTest, ConditionalParsingIfTrueFlagPresent) {
const char *Args[] = {"-fsycl-is-device", "-sycl-std=2017"};

CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags);

ASSERT_FALSE(Diags->hasErrorOccurred());
ASSERT_EQ(Invocation.getLangOpts().getSYCLVersion(), LangOptions::SYCL_2017);

Invocation.generateCC1CommandLine(GeneratedArgs, *this);

ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fsycl-is-device")));
ASSERT_THAT(GeneratedArgs, Contains(StrEq("-sycl-std=2017")));
}

// Wide integer option.

TEST_F(CommandLineTest, WideIntegerHighValue) {
Expand Down
69 changes: 0 additions & 69 deletions sycl/test/basic_tests/aliases-legacy.cpp

This file was deleted.

1 change: 0 additions & 1 deletion sycl/test/regression/unnamed-lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %clangxx -fsycl -fsyntax-only %s
// RUN: %clangxx -fsycl -sycl-std=1.2.1 -fsyntax-only %s

#include "sycl.hpp"

Expand Down
Loading