Skip to content

Commit 115f22b

Browse files
committed
Simplify -Xs handling
Signed-off-by: Julian Oppermann <[email protected]>
1 parent cb8c5b7 commit 115f22b

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

sycl-jit/jit-compiler/lib/rtc/DeviceCompilation.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -772,20 +772,14 @@ void jit_compiler::encodeBuildOptions(RTCBundleInfo &BundleInfo,
772772
std::string CompileOptions;
773773
raw_string_ostream COSOS{CompileOptions};
774774

775-
for (Arg *A : UserArgList.getArgs()) {
776-
if (!(A->getOption().matches(OPT_Xs) ||
777-
A->getOption().matches(OPT_Xs_separate))) {
778-
continue;
775+
for (Arg *A : UserArgList.filtered(OPT_Xs, OPT_Xs_separate)) {
776+
if (!CompileOptions.empty()) {
777+
COSOS << ' ';
779778
}
780-
781-
// Trim first and last quote if they exist, but no others.
782-
StringRef AV{A->getValue()};
783-
AV = AV.trim();
784-
if (AV.front() == AV.back() && (AV.front() == '\'' || AV.front() == '"')) {
785-
AV = AV.drop_front().drop_back();
779+
if (A->getOption().matches(OPT_Xs)) {
780+
COSOS << '-';
786781
}
787-
788-
COSOS << (CompileOptions.empty() ? "" : " ") << AV;
782+
COSOS << A->getValue();
789783
}
790784

791785
if (!CompileOptions.empty()) {

sycl/test-e2e/KernelCompiler/sycl_device_flags.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,12 @@ int main(int argc, char *argv[]) {
133133
source_kb kbSrc =
134134
syclex::create_kernel_bundle_from_source(ctx, lang, SYCLSource);
135135

136-
// Flags with and without space, inner quotes.
137-
std::vector<std::string> flags{"-Xs '-doubleGRF'",
138-
"-Xs'-Xfinalizer \"-printregusage\"'"};
136+
std::vector<std::string> flags{"-Xs", "-doubleGRF",
137+
"-XsXfinalizer \"-printregusage\""};
138+
if (lang == syclex::source_language::sycl) {
139+
// Flags with and without space, inner quotes.
140+
flags = {"-Xs '-doubleGRF'", "-Xs'-Xfinalizer \"-printregusage\"'"};
141+
}
139142
exe_kb kbExe =
140143
syclex::build(kbSrc, syclex::properties{syclex::build_options{flags}});
141144

0 commit comments

Comments
 (0)