Skip to content

Commit ef7beb2

Browse files
author
iclsrc
committed
Merge from 'main' to 'sycl-web' (85 commits)
2 parents f73aea2 + df3f629 commit ef7beb2

File tree

249 files changed

+8588
-2489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+8588
-2489
lines changed

.github/workflows/libc-fullbuild-tests.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,37 @@ jobs:
2121
- os: ubuntu-24.04
2222
build_type: Debug
2323
ccache-variant: sccache
24-
c_compiler: clang-20
25-
cpp_compiler: clang++-20
24+
c_compiler: clang-22
25+
cpp_compiler: clang++-22
2626
target: x86_64-unknown-linux-llvm
2727
include_scudo: ON
2828
- os: ubuntu-24.04
2929
build_type: Release
3030
ccache-variant: sccache
31-
c_compiler: clang-20
32-
cpp_compiler: clang++-20
31+
c_compiler: clang-22
32+
cpp_compiler: clang++-22
3333
target: x86_64-unknown-linux-llvm
3434
include_scudo: ON
3535
- os: ubuntu-24.04
3636
build_type: MinSizeRel
3737
ccache-variant: sccache
38-
c_compiler: clang-20
39-
cpp_compiler: clang++-20
38+
c_compiler: clang-22
39+
cpp_compiler: clang++-22
4040
target: x86_64-unknown-linux-llvm
4141
include_scudo: ON
4242
# TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved.
4343
- os: ubuntu-24.04-arm
4444
build_type: Debug
4545
ccache-variant: ccache
46-
c_compiler: clang-20
47-
cpp_compiler: clang++-20
46+
c_compiler: clang-22
47+
cpp_compiler: clang++-22
4848
target: aarch64-unknown-linux-llvm
4949
include_scudo: ON
5050
- os: ubuntu-24.04
5151
build_type: Debug
5252
ccache-variant: ccache
53-
c_compiler: clang-20
54-
cpp_compiler: clang++-20
53+
c_compiler: clang-22
54+
cpp_compiler: clang++-22
5555
target: x86_64-unknown-uefi-llvm
5656
include_scudo: OFF
5757
# TODO: add back gcc build when it is fixed
@@ -81,7 +81,7 @@ jobs:
8181
run: |
8282
wget https://apt.llvm.org/llvm.sh
8383
chmod +x llvm.sh
84-
sudo ./llvm.sh 20
84+
sudo ./llvm.sh 22
8585
sudo apt-get update
8686
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-libc-dev
8787
sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm

clang/include/clang/AST/OpenACCClause.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,23 +837,43 @@ class OpenACCClauseWithVarList : public OpenACCClauseWithExprs {
837837

838838
class OpenACCPrivateClause final
839839
: public OpenACCClauseWithVarList,
840-
private llvm::TrailingObjects<OpenACCPrivateClause, Expr *> {
840+
private llvm::TrailingObjects<OpenACCPrivateClause, Expr *, VarDecl *> {
841841
friend TrailingObjects;
842842

843843
OpenACCPrivateClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
844-
ArrayRef<Expr *> VarList, SourceLocation EndLoc)
844+
ArrayRef<Expr *> VarList,
845+
ArrayRef<VarDecl *> InitRecipes, SourceLocation EndLoc)
845846
: OpenACCClauseWithVarList(OpenACCClauseKind::Private, BeginLoc,
846847
LParenLoc, EndLoc) {
847-
setExprs(getTrailingObjects(VarList.size()), VarList);
848+
assert(VarList.size() == InitRecipes.size());
849+
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
850+
llvm::uninitialized_copy(InitRecipes, getTrailingObjects<VarDecl *>());
848851
}
849852

850853
public:
851854
static bool classof(const OpenACCClause *C) {
852855
return C->getClauseKind() == OpenACCClauseKind::Private;
853856
}
857+
// Gets a list of 'made up' `VarDecl` objects that can be used by codegen to
858+
// ensure that we properly initialize each of these variables.
859+
ArrayRef<VarDecl *> getInitRecipes() {
860+
return ArrayRef<VarDecl *>{getTrailingObjects<VarDecl *>(),
861+
getExprs().size()};
862+
}
863+
864+
ArrayRef<VarDecl *> getInitRecipes() const {
865+
return ArrayRef<VarDecl *>{getTrailingObjects<VarDecl *>(),
866+
getExprs().size()};
867+
}
868+
854869
static OpenACCPrivateClause *
855870
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
856-
ArrayRef<Expr *> VarList, SourceLocation EndLoc);
871+
ArrayRef<Expr *> VarList, ArrayRef<VarDecl *> InitRecipes,
872+
SourceLocation EndLoc);
873+
874+
size_t numTrailingObjects(OverloadToken<Expr *>) const {
875+
return getExprs().size();
876+
}
857877
};
858878

859879
class OpenACCFirstPrivateClause final

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,8 @@ TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x128_fp8_fp8, "V8fV16iV16iIsV8fIbI
795795
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x128_fp8_bf8, "V8fV16iV16iIsV8fIbIb", "nc", "gfx1250-insts,wavefrontsize32")
796796
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x128_bf8_fp8, "V8fV16iV16iIsV8fIbIb", "nc", "gfx1250-insts,wavefrontsize32")
797797
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x128_bf8_bf8, "V8fV16iV16iIsV8fIbIb", "nc", "gfx1250-insts,wavefrontsize32")
798+
TARGET_BUILTIN(__builtin_amdgcn_wmma_scale_f32_16x16x128_f8f6f4, "V8fIiV16iIiV16iIsV8fIiIiiIiIiiIbIb", "nc", "gfx1250-insts,wavefrontsize32")
799+
TARGET_BUILTIN(__builtin_amdgcn_wmma_scale16_f32_16x16x128_f8f6f4, "V8fIiV16iIiV16iIsV8fIiIiLiIiIiLiIbIb", "nc", "gfx1250-insts,wavefrontsize32")
798800
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_16x16x32_f16, "V8fIbV16hIbV16hIsV8fIbIb", "nc", "gfx1250-insts,wavefrontsize32")
799801
TARGET_BUILTIN(__builtin_amdgcn_wmma_f16_16x16x32_f16, "V8hIbV16hIbV16hIsV8hIbIb", "nc", "gfx1250-insts,wavefrontsize32")
800802
TARGET_BUILTIN(__builtin_amdgcn_wmma_f32_32x16x128_f4, "V16fV16iV8iIsV16f", "nc", "gfx1250-insts,wavefrontsize32")

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13851,7 +13851,8 @@ def err_acc_device_type_multiple_archs
1385113851
def warn_acc_var_referenced_lacks_op
1385213852
: Warning<"variable of type %0 referenced in OpenACC '%1' clause does not "
1385313853
"have a %enum_select<AccVarReferencedReason>{%DefCtor{default "
13854-
"constructor}|%Dtor{destructor}}2; reference has no effect">,
13854+
"constructor}|%CopyCtor{copy constructor}|%Dtor{destructor}}2; "
13855+
"reference has no effect">,
1385513856
InGroup<DiagGroup<"openacc-var-lacks-operation">>,
1385613857
DefaultError;
1385713858

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ class SemaOpenACC : public SemaBase {
176176

177177
void checkFor();
178178

179-
// void checkRangeFor(); ?? ERICH
180-
// const ValueDecl *checkInit();
181-
// void checkCond(const ValueDecl *Init);
182-
// void checkInc(const ValueDecl *Init);
183179
public:
184180
// Checking for non-instantiation version of a Range-for.
185181
ForStmtBeginChecker(SemaOpenACC &SemaRef, SourceLocation ForLoc,
@@ -241,6 +237,10 @@ class SemaOpenACC : public SemaBase {
241237
SourceLocation ClauseLoc,
242238
ArrayRef<const OpenACCClause *> Clauses);
243239

240+
// Creates a VarDecl with a proper default init for the purposes of a
241+
// `private` clause, so it can be used to generate a recipe later.
242+
VarDecl *CreateInitRecipe(const Expr *VarExpr);
243+
244244
public:
245245
ComputeConstructInfo &getActiveComputeConstructInfo() {
246246
return ActiveComputeConstructInfo;

clang/lib/AST/ByteCode/ByteCodeEmitter.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ int32_t ByteCodeEmitter::getOffset(LabelTy Label) {
135135
/// Helper to write bytecode and bail out if 32-bit offsets become invalid.
136136
/// Pointers will be automatically marshalled as 32-bit IDs.
137137
template <typename T>
138-
static void emit(Program &P, std::vector<std::byte> &Code, const T &Val,
139-
bool &Success) {
138+
static void emit(Program &P, llvm::SmallVectorImpl<std::byte> &Code,
139+
const T &Val, bool &Success) {
140140
size_t ValPos = Code.size();
141141
size_t Size;
142142

@@ -153,7 +153,7 @@ static void emit(Program &P, std::vector<std::byte> &Code, const T &Val,
153153
// Access must be aligned!
154154
assert(aligned(ValPos));
155155
assert(aligned(ValPos + Size));
156-
Code.resize(ValPos + Size);
156+
Code.resize_for_overwrite(ValPos + Size);
157157

158158
if constexpr (!std::is_pointer_v<T>) {
159159
new (Code.data() + ValPos) T(Val);
@@ -166,7 +166,7 @@ static void emit(Program &P, std::vector<std::byte> &Code, const T &Val,
166166
/// Emits a serializable value. These usually (potentially) contain
167167
/// heap-allocated memory and aren't trivially copyable.
168168
template <typename T>
169-
static void emitSerialized(std::vector<std::byte> &Code, const T &Val,
169+
static void emitSerialized(llvm::SmallVectorImpl<std::byte> &Code, const T &Val,
170170
bool &Success) {
171171
size_t ValPos = Code.size();
172172
size_t Size = align(Val.bytesToSerialize());
@@ -179,32 +179,32 @@ static void emitSerialized(std::vector<std::byte> &Code, const T &Val,
179179
// Access must be aligned!
180180
assert(aligned(ValPos));
181181
assert(aligned(ValPos + Size));
182-
Code.resize(ValPos + Size);
182+
Code.resize_for_overwrite(ValPos + Size);
183183

184184
Val.serialize(Code.data() + ValPos);
185185
}
186186

187187
template <>
188-
void emit(Program &P, std::vector<std::byte> &Code, const Floating &Val,
189-
bool &Success) {
188+
void emit(Program &P, llvm::SmallVectorImpl<std::byte> &Code,
189+
const Floating &Val, bool &Success) {
190190
emitSerialized(Code, Val, Success);
191191
}
192192

193193
template <>
194-
void emit(Program &P, std::vector<std::byte> &Code,
194+
void emit(Program &P, llvm::SmallVectorImpl<std::byte> &Code,
195195
const IntegralAP<false> &Val, bool &Success) {
196196
emitSerialized(Code, Val, Success);
197197
}
198198

199199
template <>
200-
void emit(Program &P, std::vector<std::byte> &Code, const IntegralAP<true> &Val,
201-
bool &Success) {
200+
void emit(Program &P, llvm::SmallVectorImpl<std::byte> &Code,
201+
const IntegralAP<true> &Val, bool &Success) {
202202
emitSerialized(Code, Val, Success);
203203
}
204204

205205
template <>
206-
void emit(Program &P, std::vector<std::byte> &Code, const FixedPoint &Val,
207-
bool &Success) {
206+
void emit(Program &P, llvm::SmallVectorImpl<std::byte> &Code,
207+
const FixedPoint &Val, bool &Success) {
208208
emitSerialized(Code, Val, Success);
209209
}
210210

clang/lib/AST/ByteCode/ByteCodeEmitter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ByteCodeEmitter {
8888
/// Location of label relocations.
8989
llvm::DenseMap<LabelTy, llvm::SmallVector<unsigned, 5>> LabelRelocs;
9090
/// Program code.
91-
std::vector<std::byte> Code;
91+
llvm::SmallVector<std::byte> Code;
9292
/// Opcode to expression mapping.
9393
SourceMap SrcMap;
9494

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,7 +2038,12 @@ bool Compiler<Emitter>::visitCallArgs(ArrayRef<const Expr *> Args,
20382038
const FunctionDecl *FuncDecl,
20392039
bool Activate) {
20402040
assert(VarScope->getKind() == ScopeKind::Call);
2041-
llvm::BitVector NonNullArgs = collectNonNullArgs(FuncDecl, Args);
2041+
bool HasNonNullAttr = false;
2042+
llvm::BitVector NonNullArgs;
2043+
if (FuncDecl && FuncDecl->hasAttr<NonNullAttr>()) {
2044+
HasNonNullAttr = true;
2045+
NonNullArgs = collectNonNullArgs(FuncDecl, Args);
2046+
}
20422047

20432048
unsigned ArgIndex = 0;
20442049
for (const Expr *Arg : Args) {
@@ -2064,7 +2069,7 @@ bool Compiler<Emitter>::visitCallArgs(ArrayRef<const Expr *> Args,
20642069
return false;
20652070
}
20662071

2067-
if (FuncDecl && NonNullArgs[ArgIndex]) {
2072+
if (HasNonNullAttr && NonNullArgs[ArgIndex]) {
20682073
PrimType ArgT = classify(Arg).value_or(PT_Ptr);
20692074
if (ArgT == PT_Ptr) {
20702075
if (!this->emitCheckNonNullArg(ArgT, Arg))
@@ -5914,7 +5919,7 @@ bool Compiler<Emitter>::emitLambdaStaticInvokerBody(const CXXMethodDecl *MD) {
59145919

59155920
const CXXRecordDecl *ClosureClass = MD->getParent();
59165921
const CXXMethodDecl *LambdaCallOp = ClosureClass->getLambdaCallOperator();
5917-
assert(ClosureClass->captures_begin() == ClosureClass->captures_end());
5922+
assert(ClosureClass->captures().empty());
59185923
const Function *Func = this->getFunction(LambdaCallOp);
59195924
if (!Func)
59205925
return false;

clang/lib/AST/ByteCode/Context.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ bool Context::isPotentialConstantExpr(State &Parent, const FunctionDecl *FD) {
4545
Compiler<ByteCodeEmitter>(*this, *P).compileFunc(
4646
FD, const_cast<Function *>(Func));
4747

48-
++EvalID;
49-
// And run it.
50-
if (!Run(Parent, Func))
48+
if (!Func->isValid())
5149
return false;
5250

53-
return Func->isValid();
51+
++EvalID;
52+
// And run it.
53+
return Run(Parent, Func);
5454
}
5555

5656
void Context::isPotentialConstantExprUnevaluated(State &Parent, const Expr *E,
@@ -474,7 +474,7 @@ const Function *Context::getOrCreateFunction(const FunctionDecl *FuncDecl) {
474474
IsLambdaStaticInvoker = true;
475475

476476
const CXXRecordDecl *ClosureClass = MD->getParent();
477-
assert(ClosureClass->captures_begin() == ClosureClass->captures_end());
477+
assert(ClosureClass->captures().empty());
478478
if (ClosureClass->isGenericLambda()) {
479479
const CXXMethodDecl *LambdaCallOp = ClosureClass->getLambdaCallOperator();
480480
assert(MD->isFunctionTemplateSpecialization() &&

clang/lib/AST/ByteCode/EvalEmitter.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,14 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(const SourceInfo &Info) {
233233
return false;
234234
}
235235
} else {
236+
// If this is pointing to a local variable, just return
237+
// the result, even if the pointer is dead.
238+
// This will later be diagnosed by CheckLValueConstantExpression.
239+
if (Ptr.isBlockPointer() && !Ptr.block()->isStatic()) {
240+
EvalResult.setValue(Ptr.toAPValue(Ctx.getASTContext()));
241+
return true;
242+
}
243+
236244
if (!Ptr.isLive() && !Ptr.isTemporary())
237245
return false;
238246

0 commit comments

Comments
 (0)