Skip to content

Commit eb7c318

Browse files
committed
Merge remote-tracking branch 'upstream/sycl' into dup-attr-refactor
2 parents bbb391d + 73b7da0 commit eb7c318

File tree

18 files changed

+617
-75
lines changed

18 files changed

+617
-75
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,6 +2418,26 @@ device kernel, the attribute is not ignored and it is propagated to the kernel.
24182418
[[intel::num_simd_work_items(N)]] void operator()() const {}
24192419
};
24202420

2421+
If the`` intel::reqd_work_group_size`` or ``cl::reqd_work_group_size``
2422+
attribute is specified on a declaration along with a
2423+
intel::num_simd_work_items attribute, the work group size attribute
2424+
arguments must all be evenly divisible by the argument specified in
2425+
the ``intel::num_simd_work_items`` attribute.
2426+
2427+
.. code-block:: c++
2428+
2429+
struct func {
2430+
[[intel::num_simd_work_items(4)]]
2431+
[[intel::reqd_work_group_size(64, 64, 64)]]
2432+
void operator()() const {}
2433+
};
2434+
2435+
struct bar {
2436+
[[intel::reqd_work_group_size(64, 64, 64)]]
2437+
[[intel::num_simd_work_items(4)]]
2438+
void operator()() const {}
2439+
};
2440+
24212441
}];
24222442
}
24232443

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11212,6 +11212,9 @@ def err_sycl_invalid_accessor_property_list_template_param : Error<
1121211212
"%select{accessor_property_list|accessor_property_list pack argument|buffer_location}0 "
1121311213
"template parameter must be a "
1121411214
"%select{parameter pack|type|non-negative integer}1">;
11215+
def err_sycl_num_kernel_wrong_reqd_wg_size : Error<
11216+
"%0 attribute must evenly divide the work-group size for the %1 attribute">;
11217+
1121511218
def warn_sycl_pass_by_value_deprecated
1121611219
: Warning<"Passing kernel functions by value is deprecated in SYCL 2020">,
1121711220
InGroup<Sycl2020Compat>, ShowInSystemHeader;

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13091,6 +13091,8 @@ void Sema::addIntelSingleArgAttr(Decl *D, const AttributeCommonInfo &CI,
1309113091
<< CI << /*non-negative*/ 1;
1309213092
return;
1309313093
}
13094+
}
13095+
if (CI.getParsedKind() == ParsedAttr::AT_SYCLIntelMaxGlobalWorkDim) {
1309413096
if (ArgInt > 3) {
1309513097
Diag(E->getBeginLoc(), diag::err_attribute_argument_out_of_range)
1309613098
<< CI << 0 << 3 << E->getSourceRange();

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8269,6 +8269,32 @@ static void addArgs(ArgStringList &DstArgs, const llvm::opt::ArgList &Alloc,
82698269
}
82708270
}
82718271

8272+
// Partially copied from clang/lib/Frontend/CompilerInvocation.cpp
8273+
static std::string getSYCLPostLinkOptimizationLevel(const ArgList &Args) {
8274+
if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
8275+
if (A->getOption().matches(options::OPT_O0))
8276+
return "-O0";
8277+
8278+
if (A->getOption().matches(options::OPT_Ofast))
8279+
return "-O3";
8280+
8281+
assert(A->getOption().matches(options::OPT_O));
8282+
8283+
StringRef S(A->getValue());
8284+
if (S == "g")
8285+
return "-O1";
8286+
8287+
// Options -O[1|2|3|s|z] are passed as they are. '-O0' is handled earlier.
8288+
std::array<char, 5> AcceptedOptions = {'1', '2', '3', 's', 'z'};
8289+
if (std::any_of(AcceptedOptions.begin(), AcceptedOptions.end(),
8290+
[=](char c) { return c == S[0]; }))
8291+
return std::string("-O") + S[0];
8292+
}
8293+
8294+
// The default for SYCL device code optimization
8295+
return "-O2";
8296+
}
8297+
82728298
// sycl-post-link tool normally outputs a file table (see the tool sources for
82738299
// format description) which lists all the other output files associated with
82748300
// the device LLVMIR bitcode. This is basically a triple of bitcode, symbols
@@ -8325,6 +8351,8 @@ void SYCLPostLink::ConstructJob(Compilation &C, const JobAction &JA,
83258351
options::OPT_fno_sycl_device_code_lower_esimd, false))
83268352
addArgs(CmdArgs, TCArgs, {"-lower-esimd"});
83278353
}
8354+
addArgs(CmdArgs, TCArgs,
8355+
{StringRef(getSYCLPostLinkOptimizationLevel(TCArgs))});
83288356
// specialization constants processing is mandatory
83298357
auto *SYCLPostLink = llvm::dyn_cast<SYCLPostLinkJobAction>(&JA);
83308358
if (SYCLPostLink && SYCLPostLink->getRTSetsSpecConstants())

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 62 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3130,26 +3130,53 @@ static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
31303130
return;
31313131
}
31323132

3133-
if (WorkGroupAttr *ExistingAttr = D->getAttr<WorkGroupAttr>()) {
3134-
ASTContext &Ctx = S.getASTContext();
3135-
Optional<llvm::APSInt> XDimVal = XDimExpr->getIntegerConstantExpr(Ctx);
3136-
Optional<llvm::APSInt> YDimVal = YDimExpr->getIntegerConstantExpr(Ctx);
3137-
Optional<llvm::APSInt> ZDimVal = ZDimExpr->getIntegerConstantExpr(Ctx);
3138-
Optional<llvm::APSInt> ExistingXDimVal = ExistingAttr->getXDimVal(Ctx);
3139-
Optional<llvm::APSInt> ExistingYDimVal = ExistingAttr->getYDimVal(Ctx);
3140-
Optional<llvm::APSInt> ExistingZDimVal = ExistingAttr->getZDimVal(Ctx);
3141-
3142-
// Compare attribute arguments value and warn for a mismatch.
3143-
if (ExistingXDimVal != XDimVal || ExistingYDimVal != YDimVal ||
3144-
ExistingZDimVal != ZDimVal) {
3145-
S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL;
3146-
S.Diag(ExistingAttr->getLocation(), diag::note_conflicting_attribute);
3133+
ASTContext &Ctx = S.getASTContext();
3134+
3135+
if (!XDimExpr->isValueDependent() && !YDimExpr->isValueDependent() &&
3136+
!ZDimExpr->isValueDependent()) {
3137+
llvm::APSInt XDimVal, YDimVal, ZDimVal;
3138+
ExprResult XDim = S.VerifyIntegerConstantExpression(XDimExpr, &XDimVal);
3139+
ExprResult YDim = S.VerifyIntegerConstantExpression(YDimExpr, &YDimVal);
3140+
ExprResult ZDim = S.VerifyIntegerConstantExpression(ZDimExpr, &ZDimVal);
3141+
3142+
if (XDim.isInvalid())
3143+
return;
3144+
XDimExpr = XDim.get();
3145+
3146+
if (YDim.isInvalid())
3147+
return;
3148+
YDimExpr = YDim.get();
3149+
3150+
if (ZDim.isInvalid())
3151+
return;
3152+
ZDimExpr = ZDim.get();
3153+
3154+
if (const auto *A = D->getAttr<SYCLIntelNumSimdWorkItemsAttr>()) {
3155+
int64_t NumSimdWorkItems =
3156+
A->getValue()->getIntegerConstantExpr(Ctx)->getSExtValue();
3157+
3158+
if (!(XDimVal.getZExtValue() % NumSimdWorkItems == 0 ||
3159+
YDimVal.getZExtValue() % NumSimdWorkItems == 0 ||
3160+
ZDimVal.getZExtValue() % NumSimdWorkItems == 0)) {
3161+
S.Diag(A->getLocation(), diag::err_sycl_num_kernel_wrong_reqd_wg_size)
3162+
<< A << AL;
3163+
S.Diag(AL.getLoc(), diag::note_conflicting_attribute);
3164+
return;
3165+
}
31473166
}
3167+
if (const auto *ExistingAttr = D->getAttr<WorkGroupAttr>()) {
3168+
// Compare attribute arguments value and warn for a mismatch.
3169+
if (ExistingAttr->getXDimVal(Ctx) != XDimVal ||
3170+
ExistingAttr->getYDimVal(Ctx) != YDimVal ||
3171+
ExistingAttr->getZDimVal(Ctx) != ZDimVal) {
3172+
S.Diag(AL.getLoc(), diag::warn_duplicate_attribute) << AL;
3173+
S.Diag(ExistingAttr->getLocation(), diag::note_conflicting_attribute);
3174+
}
3175+
}
3176+
if (!checkWorkGroupSizeValues(S, D, AL))
3177+
return;
31483178
}
31493179

3150-
if (!checkWorkGroupSizeValues(S, D, AL))
3151-
return;
3152-
31533180
S.addIntelTripleArgAttr<WorkGroupAttr>(D, AL, XDimExpr, YDimExpr, ZDimExpr);
31543181
}
31553182

@@ -3279,6 +3306,22 @@ void Sema::AddSYCLIntelNumSimdWorkItemsAttr(Decl *D,
32793306
return;
32803307
}
32813308
}
3309+
3310+
// If the declaration has an [[intel::reqd_work_group_size]] attribute,
3311+
// check to see if can be evenly divided by the num_simd_work_items attr.
3312+
if (const auto *DeclAttr = D->getAttr<ReqdWorkGroupSizeAttr>()) {
3313+
Optional<llvm::APSInt> XDimVal = DeclAttr->getXDimVal(Context);
3314+
Optional<llvm::APSInt> YDimVal = DeclAttr->getYDimVal(Context);
3315+
Optional<llvm::APSInt> ZDimVal = DeclAttr->getZDimVal(Context);
3316+
3317+
if (*XDimVal % ArgVal != 0 || *YDimVal % ArgVal != 0 ||
3318+
*ZDimVal % ArgVal != 0) {
3319+
Diag(CI.getLoc(), diag::err_sycl_num_kernel_wrong_reqd_wg_size)
3320+
<< CI << DeclAttr;
3321+
Diag(DeclAttr->getLocation(), diag::note_conflicting_attribute);
3322+
return;
3323+
}
3324+
}
32823325
}
32833326

32843327
D->addAttr(::new (Context) SYCLIntelNumSimdWorkItemsAttr(Context, CI, E));
@@ -6067,14 +6110,13 @@ void Sema::addSYCLIntelPipeIOAttr(Decl *D, const AttributeCommonInfo &Attr,
60676110
Optional<llvm::APSInt> ArgVal = E->getIntegerConstantExpr(getASTContext());
60686111
if (!ArgVal) {
60696112
Diag(E->getExprLoc(), diag::err_attribute_argument_type)
6070-
<< Attr.getAttrName() << AANT_ArgumentIntegerConstant
6071-
<< E->getSourceRange();
6113+
<< Attr << AANT_ArgumentIntegerConstant << E->getSourceRange();
60726114
return;
60736115
}
60746116
int32_t ArgInt = ArgVal->getSExtValue();
60756117
if (ArgInt < 0) {
60766118
Diag(E->getExprLoc(), diag::err_attribute_requires_positive_integer)
6077-
<< Attr.getAttrName() << /*non-negative*/ 1;
6119+
<< Attr << /*non-negative*/ 1;
60786120
return;
60796121
}
60806122
}

clang/test/Driver/sycl-device-lib.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
// RUN: | FileCheck %s -check-prefix=SYCL_LLVM_LINK_NO_DEVICE_LIB
122122
// SYCL_LLVM_LINK_NO_DEVICE_LIB: clang{{.*}} "-cc1" {{.*}} "-fsycl-is-device"
123123
// SYCL_LLVM_LINK_NO_DEVICE_LIB-NOT: llvm-link{{.*}} "-only-needed"
124-
// SYCL_LLVM_LINK_NO_DEVICE_LIB: sycl-post-link{{.*}} "-symbols" "-split-esimd" "-spec-const=rt" "-o" "{{.*}}.table" "{{.*}}.bc"
124+
// SYCL_LLVM_LINK_NO_DEVICE_LIB: sycl-post-link{{.*}} "-symbols" "-split-esimd" "-O2" "-spec-const=rt" "-o" "{{.*}}.table" "{{.*}}.bc"
125125

126126
/// ###########################################################################
127127
/// test llvm-link behavior for special user input whose filename resembles SYCL device library

clang/test/Driver/sycl-intelfpga-aoco-win.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
// CHK-FPGA-AOCO: llvm-link{{.*}} "[[OUTLIB]]" "-o" "[[LINKEDBC:.+\.bc]]"
4848
// CHK-FPGA-AOCO: sycl-post-link
4949
// CHK-FPGA-AOCO-NOT: -split-esimd
50-
// CHK-FPGA-AOCO: "-ir-output-only" "-spec-const=default" "-o" "[[PLINKEDBC:.+\.bc]]" "[[LINKEDBC]]"
50+
// CHK-FPGA-AOCO: "-ir-output-only" "-O2" "-spec-const=default" "-o" "[[PLINKEDBC:.+\.bc]]" "[[LINKEDBC]]"
5151
// CHK-FPGA-AOCO: llvm-spirv{{.*}} "-o" "[[TARGSPV:.+\.spv]]" {{.*}} "[[PLINKEDBC]]"
5252
// CHK-FPGA-AOCO: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-fpga_aoco-intel-unknown-sycldevice" "-inputs=[[INPUTLIB]]" "-outputs=[[AOCOLIST:.+\.txt]]" "-unbundle"
5353
// CHK-FPGA-AOCO: aoc{{.*}} "-o" "[[AOCXOUT:.+\.aocx]]" "[[TARGSPV]]" "-library-list=[[AOCOLIST]]" "-sycl"

clang/test/Driver/sycl-intelfpga-aoco.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
// CHK-FPGA-AOCO: llvm-link{{.*}} "[[OUTLIB]]" "-o" "[[LINKEDBC:.+\.bc]]"
8686
// CHK-FPGA-AOCO: sycl-post-link
8787
// CHK-FPGA-AOCO-NOT: "-split-esimd"
88-
// CHK-FPGA-AOCO: "-ir-output-only" "-spec-const=default" "-o" "[[PLINKEDBC:.+\.bc]]" "[[LINKEDBC]]"
88+
// CHK-FPGA-AOCO: "-ir-output-only" "-O2" "-spec-const=default" "-o" "[[PLINKEDBC:.+\.bc]]" "[[LINKEDBC]]"
8989
// CHK-FPGA-AOCO: llvm-spirv{{.*}} "-o" "[[TARGSPV:.+\.spv]]" {{.*}} "[[PLINKEDBC]]"
9090
// CHK-FPGA-AOCO: clang-offload-bundler{{.*}} "-type=aoo" "-targets=sycl-fpga_aoco-intel-unknown-sycldevice" "-inputs=[[INPUTLIB]]" "-outputs=[[AOCOLIST:.+\.txt]]" "-unbundle"
9191
// CHK-FPGA-AOCO: aoc{{.*}} "-o" "[[AOCXOUT:.+\.aocx]]" "[[TARGSPV]]" "-library-list=[[AOCOLIST]]" "-sycl"

clang/test/Driver/sycl-offload-intelfpga.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// CHK-FPGA-LINK: llvm-link{{.*}} "[[OUTPUT1]]" "-o" "[[OUTPUT2_1:.+\.bc]]"
3434
// CHK-FPGA-LINK: sycl-post-link
3535
// CHK-FPGA-LINK-NOT: -split-esimd
36-
// CHK-FPGA-LINK: "-ir-output-only" "-spec-const=default" "-o" "[[OUTPUT2:.+\.bc]]" "[[OUTPUT2_1]]"
36+
// CHK-FPGA-LINK: "-ir-output-only" "-O2" "-spec-const=default" "-o" "[[OUTPUT2:.+\.bc]]" "[[OUTPUT2_1]]"
3737
// CHK-FPGA-LINK: llvm-spirv{{.*}} "-o" "[[OUTPUT3:.+\.spv]]" "-spirv-max-version=1.1" "-spirv-debug-info-version=legacy" "-spirv-allow-extra-diexpressions" "-spirv-ext=+all,-SPV_INTEL_usm_storage_classes" "[[OUTPUT2]]"
3838
// CHK-FPGA-EARLY: aoc{{.*}} "-o" "[[OUTPUT4:.+\.aocr]]" "[[OUTPUT3]]" "-sycl" "-rtl"
3939
// CHK-FPGA-IMAGE: aoc{{.*}} "-o" "[[OUTPUT5:.+\.aocx]]" "[[OUTPUT3]]" "-sycl"
@@ -67,7 +67,7 @@
6767
// CHK-FPGA-LINK-WIN: llvm-link{{.*}} "[[OUTPUT1]]" "-o" "[[OUTPUT2_1:.+\.bc]]"
6868
// CHK-FPGA-LINK-WIN: sycl-post-link
6969
// CHK-FPGA-LINK-WIN-NOT: -split-esimd
70-
// CHK-FPGA-LINK-WIN: "-ir-output-only" "-spec-const=default" "-o" "[[OUTPUT2:.+\.bc]]" "[[OUTPUT2_1]]"
70+
// CHK-FPGA-LINK-WIN: "-ir-output-only" "-O2" "-spec-const=default" "-o" "[[OUTPUT2:.+\.bc]]" "[[OUTPUT2_1]]"
7171
// CHK-FPGA-LINK-WIN: llvm-spirv{{.*}} "-o" "[[OUTPUT3:.+\.spv]]" "-spirv-max-version=1.1" "-spirv-debug-info-version=legacy" "-spirv-allow-extra-diexpressions" "-spirv-ext=+all,-SPV_INTEL_usm_storage_classes" "[[OUTPUT2]]"
7272
// CHK-FPGA-LINK-WIN: aoc{{.*}} "-o" "[[OUTPUT5:.+\.aocr]]" "[[OUTPUT3]]" "-sycl" "-rtl"
7373
// CHK-FPGA-LINK-WIN: clang-offload-wrapper{{.*}} "-o=[[WRAPOUT:.+\.bc]]" {{.*}} "-kind=sycl"
@@ -132,7 +132,7 @@
132132
// CHK-FPGA: llvm-link{{.*}} "[[OUTPUT1]]" "-o" "[[OUTPUT2_BC:.+\.bc]]"
133133
// CHK-FPGA: sycl-post-link
134134
// CHK-FPGA-NOT: -split-esimd
135-
// CHK-FPGA: "-ir-output-only" "-spec-const=default" "-o" "[[OUTPUT3_BC:.+\.bc]]" "[[OUTPUT2_BC]]"
135+
// CHK-FPGA: "-ir-output-only" "-O2" "-spec-const=default" "-o" "[[OUTPUT3_BC:.+\.bc]]" "[[OUTPUT2_BC]]"
136136
// CHK-FPGA: llvm-spirv{{.*}} "-o" "[[OUTPUT5:.+\.spv]]" "-spirv-max-version=1.1" "-spirv-debug-info-version=legacy" "-spirv-allow-extra-diexpressions" "-spirv-ext=+all,-SPV_INTEL_usm_storage_classes" "[[OUTPUT3_BC]]"
137137
// CHK-FPGA: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-fpga_dep" {{.*}} "-outputs=[[DEPFILE:.+\.d]]" "-unbundle"
138138
// CHK-FPGA: aoc{{.*}} "-o" "[[OUTPUT6:.+\.aocx]]" "[[OUTPUT5]]" "-sycl" "-dep-files=[[DEPFILE]]"
@@ -186,7 +186,7 @@
186186
// CHK-FPGA-AOCX-SRC: llvm-link{{.*}} "[[DEVICEBC]]" "-o" "[[LLVMLINKOUT:.+\.bc]]" "--suppress-warnings"
187187
// CHK-FPGA-AOCX-SRC: sycl-post-link
188188
// CHK-FPGA-AOCX-SRC-NOT: -split-esimd
189-
// CHK-FPGA-AOCX-SRC: "-ir-output-only" "-spec-const=default" "-o" "[[POSTLINKOUT:.+\.bc]]" "[[LLVMLINKOUT]]
189+
// CHK-FPGA-AOCX-SRC: "-ir-output-only" "-O2" "-spec-const=default" "-o" "[[POSTLINKOUT:.+\.bc]]" "[[LLVMLINKOUT]]
190190
// CHK-FPGA-AOCX-SRC: llvm-spirv{{.*}} "-o" "[[LLVMSPVOUT:.+\.spv]]" {{.*}} "[[POSTLINKOUT]]"
191191
// CHK-FPGA-AOCX-SRC: aoc{{.*}} "-o" "[[AOCOUT:.+\.aocx]]" "[[LLVMSPVOUT]]" "-sycl"
192192
// CHK-FPGA-AOCX-SRC: clang-offload-wrapper{{.*}} "-o=[[WRAPOUTSRC:.+.bc]]" {{.*}} "-target=spir64_fpga" "-kind=sycl" "[[AOCOUT]]"
@@ -209,7 +209,7 @@
209209
// CHK-FPGA-AOCX-OBJ: llvm-link{{.*}} "[[DEVICEOBJ]]" "-o" "[[LLVMLINKOUT:.+\.bc]]" "--suppress-warnings"
210210
// CHK-FPGA-AOCX-OBJ: sycl-post-link
211211
// CHK-FPGA-AOCX-OBJ-NOT: -split-esimd
212-
// CHK-FPGA-AOCX-OBJ: "-ir-output-only" "-spec-const=default" "-o" "[[POSTLINKOUT:.+\.bc]]" "[[LLVMLINKOUT]]
212+
// CHK-FPGA-AOCX-OBJ: "-ir-output-only" "-O2" "-spec-const=default" "-o" "[[POSTLINKOUT:.+\.bc]]" "[[LLVMLINKOUT]]
213213
// CHK-FPGA-AOCX-OBJ: llvm-spirv{{.*}} "-o" "[[LLVMSPVOUT:.+\.spv]]" {{.*}} "[[POSTLINKOUT]]"
214214
// CHK-FPGA-AOCX-OBJ: aoc{{.*}} "-o" "[[AOCOUT:.+\.aocx]]" "[[LLVMSPVOUT]]" "-sycl"
215215
// CHK-FPGA-AOCX-OBJ: clang-offload-wrapper{{.*}} "-o=[[WRAPOUTSRC:.+.bc]]" {{.*}} "-target=spir64_fpga" "-kind=sycl" "[[AOCOUT]]"

clang/test/Driver/sycl-offload.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,3 +903,33 @@
903903
// CHECK-STD-OVR: clang{{.*}} "-fsyntax-only" {{.*}} "-std=c++14"
904904
// CHECK-STD-OVR: clang{{.*}} "-emit-obj" {{.*}} "-std=c++14"
905905
// CHECK-STD-OVR-NOT: clang{{.*}} "-std=c++17"
906+
907+
// Check sycl-post-link optimization level.
908+
// Default is O2
909+
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O2
910+
// RUN: %clang_cl -### -fsycl %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O2
911+
// Common options for %clang and %clang_cl
912+
// RUN: %clang -### -fsycl -O1 %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O1
913+
// RUN: %clang_cl -### -fsycl /O1 %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-Os
914+
// RUN: %clang -### -fsycl -O2 %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O2
915+
// RUN: %clang_cl -### -fsycl /O2 %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O2
916+
// RUN: %clang -### -fsycl -Os %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-Os
917+
// RUN: %clang_cl -### -fsycl /Os %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-Os
918+
// %clang options
919+
// RUN: %clang -### -fsycl -O0 %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O0
920+
// RUN: %clang -### -fsycl -Ofast %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O3
921+
// RUN: %clang -### -fsycl -O3 %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O3
922+
// RUN: %clang -### -fsycl -Oz %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-Oz
923+
// RUN: %clang -### -fsycl -Og %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O1
924+
// %clang_cl options
925+
// RUN: %clang_cl -### -fsycl /Od %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O0
926+
// RUN: %clang_cl -### -fsycl /Ot %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O2
927+
// only the last option is considered
928+
// RUN: %clang -### -fsycl -O2 -O1 %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-O1
929+
// RUN: %clang_cl -### -fsycl /O2 /O1 %s 2>&1 | FileCheck %s -check-prefixes=CHK-POST-LINK-OPT-LEVEL-Os
930+
// CHK-POST-LINK-OPT-LEVEL-O0: sycl-post-link{{.*}} "-O0"
931+
// CHK-POST-LINK-OPT-LEVEL-O1: sycl-post-link{{.*}} "-O1"
932+
// CHK-POST-LINK-OPT-LEVEL-O2: sycl-post-link{{.*}} "-O2"
933+
// CHK-POST-LINK-OPT-LEVEL-O3: sycl-post-link{{.*}} "-O3"
934+
// CHK-POST-LINK-OPT-LEVEL-Os: sycl-post-link{{.*}} "-Os"
935+
// CHK-POST-LINK-OPT-LEVEL-Oz: sycl-post-link{{.*}} "-Oz"

0 commit comments

Comments
 (0)