Skip to content

Commit de72e1e

Browse files
authored
Merge branch 'main' into sccp/phi_for_const_struct
2 parents cccfd97 + c491c6e commit de72e1e

File tree

216 files changed

+61077
-29806
lines changed

Some content is hidden

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

216 files changed

+61077
-29806
lines changed

clang/docs/OpenMPSupport.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ implementation.
193193
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
194194
| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
195195
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
196-
| device | pointer attachment | :good:`done` | |
196+
| device | pointer attachment | :part:`being repaired` | @abhinavgaba (https://github.com/llvm/llvm-project/pull/153683) |
197197
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
198198
| atomic | hints for the atomic construct | :good:`done` | D51233 |
199199
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -627,6 +627,10 @@ implementation.
627627
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
628628
| loop grid/tile modifiers for sizes clause | :none:`unclaimed` | :none:`unclaimed` | |
629629
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
630+
| attach map-type modifier | :part:`In Progress` | :none:`unclaimed` | C/C++: @abhinavgaba; |
631+
| | | | RT: @abhinavgaba (https://github.com/llvm/llvm-project/pull/149036, |
632+
| | | | https://github.com/llvm/llvm-project/pull/158370) |
633+
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
630634

631635

632636
OpenMP Extensions

clang/docs/ReleaseNotes.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ AST Dumping Potentially Breaking Changes
128128

129129
- Default arguments of template template parameters are pretty-printed now.
130130

131+
- Pretty-printing of ``asm`` attributes are now always the first attribute
132+
on the right side of the declaration. Before we had, e.g.:
133+
134+
``__attribute__(("visibility")) asm("string")``
135+
136+
Now we have:
137+
138+
``asm("string") __attribute__(("visibility"))``
139+
140+
Which is accepted by both clang and gcc parsers.
141+
131142
Clang Frontend Potentially Breaking Changes
132143
-------------------------------------------
133144
- Members of anonymous unions/structs are now injected as ``IndirectFieldDecl``
@@ -271,6 +282,8 @@ Non-comprehensive list of changes in this release
271282
allocation functions with a token ID can be enabled via the
272283
``-fsanitize=alloc-token`` flag.
273284

285+
- Clang now rejects the invalid use of ``constexpr`` with ``auto`` and an explicit type in C. (#GH163090)
286+
274287
New Compiler Flags
275288
------------------
276289
- New option ``-fno-sanitize-debug-trap-reasons`` added to disable emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).
@@ -476,6 +489,7 @@ Bug Fixes to C++ Support
476489
- Fix a crash when attempting to deduce a deduction guide from a non deducible template template parameter. (#130604)
477490
- Fix for clang incorrectly rejecting the default construction of a union with
478491
nontrivial member when another member has an initializer. (#GH81774)
492+
- Fixed a template depth issue when parsing lambdas inside a type constraint. (#GH162092)
479493
- Diagnose unresolved overload sets in non-dependent compound requirements. (#GH51246) (#GH97753)
480494

481495
Bug Fixes to AST Handling

clang/include/clang/Basic/Builtins.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4957,6 +4957,18 @@ def HLSLResourceNonUniformIndex : LangBuiltin<"HLSL_LANG"> {
49574957
let Prototype = "uint32_t(uint32_t)";
49584958
}
49594959

4960+
def HLSLResourceGetDimensionsX : LangBuiltin<"HLSL_LANG"> {
4961+
let Spellings = ["__builtin_hlsl_resource_getdimensions_x"];
4962+
let Attributes = [NoThrow];
4963+
let Prototype = "void(...)";
4964+
}
4965+
4966+
def HLSLResourceGetStride : LangBuiltin<"HLSL_LANG"> {
4967+
let Spellings = ["__builtin_hlsl_resource_getstride"];
4968+
let Attributes = [NoThrow];
4969+
let Prototype = "void(...)";
4970+
}
4971+
49604972
def HLSLAll : LangBuiltin<"HLSL_LANG"> {
49614973
let Spellings = ["__builtin_hlsl_all"];
49624974
let Attributes = [NoThrow, Const];

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4408,12 +4408,12 @@ def CIR_TryOp : CIR_Op<"try",[
44084408
let arguments = (ins
44094409
UnitAttr:$synthetic,
44104410
UnitAttr:$cleanup,
4411-
CIR_TryHandlerArrayAttr:$handler_types
4411+
DefaultValuedAttr<CIR_TryHandlerArrayAttr, "{}">:$handler_types
44124412
);
44134413

44144414
let regions = (region
44154415
AnyRegion:$try_region,
4416-
VariadicRegion<MinSizedRegion<1>>:$handler_regions
4416+
VariadicRegion<AnyRegion>:$handler_regions
44174417
);
44184418

44194419
let assemblyFormat = [{

clang/include/clang/Sema/Sema.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,6 +3961,13 @@ class Sema final : public SemaBase {
39613961
bool &AddToScope,
39623962
ArrayRef<BindingDecl *> Bindings = {});
39633963

3964+
private:
3965+
// Perform a check on an AsmLabel to verify its consistency and emit
3966+
// diagnostics in case of an error.
3967+
void CheckAsmLabel(Scope *S, Expr *AsmLabelExpr, StorageClass SC,
3968+
TypeSourceInfo *TInfo, VarDecl *);
3969+
3970+
public:
39643971
/// Perform semantic checking on a newly-created variable
39653972
/// declaration.
39663973
///

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3285,14 +3285,14 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
32853285
case Builtin::BI__builtin_parityl:
32863286
case Builtin::BI__builtin_parityll:
32873287
return interp__builtin_elementwise_int_unaryop(
3288-
S, OpPC, Call, [](const APSInt &Val) -> APInt {
3288+
S, OpPC, Call, [](const APSInt &Val) {
32893289
return APInt(Val.getBitWidth(), Val.popcount() % 2);
32903290
});
32913291
case Builtin::BI__builtin_clrsb:
32923292
case Builtin::BI__builtin_clrsbl:
32933293
case Builtin::BI__builtin_clrsbll:
32943294
return interp__builtin_elementwise_int_unaryop(
3295-
S, OpPC, Call, [](const APSInt &Val) -> APInt {
3295+
S, OpPC, Call, [](const APSInt &Val) {
32963296
return APInt(Val.getBitWidth(),
32973297
Val.getBitWidth() - Val.getSignificantBits());
32983298
});
@@ -3301,8 +3301,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
33013301
case Builtin::BI__builtin_bitreverse32:
33023302
case Builtin::BI__builtin_bitreverse64:
33033303
return interp__builtin_elementwise_int_unaryop(
3304-
S, OpPC, Call,
3305-
[](const APSInt &Val) -> APInt { return Val.reverseBits(); });
3304+
S, OpPC, Call, [](const APSInt &Val) { return Val.reverseBits(); });
33063305

33073306
case Builtin::BI__builtin_classify_type:
33083307
return interp__builtin_classify_type(S, OpPC, Frame, Call);

clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,7 @@ const char *vTableClassNameForType(const CIRGenModule &cgm, const Type *ty) {
950950
break;
951951

952952
case Type::Enum:
953-
cgm.errorNYI("VTableClassNameForType: Enum");
954-
break;
953+
return "_ZTVN10__cxxabiv116__enum_type_infoE";
955954

956955
case Type::Record: {
957956
const auto *rd = cast<CXXRecordDecl>(cast<RecordType>(ty)->getDecl())

clang/lib/CIR/CodeGen/CIRGenValue.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ class AggValueSlot {
307307
/// This is set to true if some external code is responsible for setting up a
308308
/// destructor for the slot. Otherwise the code which constructs it should
309309
/// push the appropriate cleanup.
310-
LLVM_PREFERRED_TYPE(bool)
311-
[[maybe_unused]] unsigned destructedFlag : 1;
310+
[[maybe_unused]]
311+
LLVM_PREFERRED_TYPE(bool) unsigned destructedFlag : 1;
312312

313313
/// This is set to true if the memory in the slot is known to be zero before
314314
/// the assignment into it. This means that zero fields don't need to be set.
@@ -326,16 +326,16 @@ class AggValueSlot {
326326
/// over. Since it's invalid in general to memcpy a non-POD C++
327327
/// object, it's important that this flag never be set when
328328
/// evaluating an expression which constructs such an object.
329-
LLVM_PREFERRED_TYPE(bool)
330-
[[maybe_unused]] unsigned aliasedFlag : 1;
329+
[[maybe_unused]]
330+
LLVM_PREFERRED_TYPE(bool) unsigned aliasedFlag : 1;
331331

332332
/// This is set to true if the tail padding of this slot might overlap
333333
/// another object that may have already been initialized (and whose
334334
/// value must be preserved by this initialization). If so, we may only
335335
/// store up to the dsize of the type. Otherwise we can widen stores to
336336
/// the size of the type.
337-
LLVM_PREFERRED_TYPE(bool)
338-
[[maybe_unused]] unsigned overlapFlag : 1;
337+
[[maybe_unused]]
338+
LLVM_PREFERRED_TYPE(bool) unsigned overlapFlag : 1;
339339

340340
public:
341341
enum IsDestructed_t { IsNotDestructed, IsDestructed };

clang/lib/CIR/Dialect/IR/CIRDialect.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,8 +3011,11 @@ static mlir::ParseResult parseTryHandlerRegions(
30113011
return failure();
30123012
}
30133013

3014-
if (!currRegion.empty() && !(currRegion.back().mightHaveTerminator() &&
3015-
currRegion.back().getTerminator()))
3014+
if (currRegion.empty())
3015+
return parser.emitError(regionLoc, "handler region shall not be empty");
3016+
3017+
if (!(currRegion.back().mightHaveTerminator() &&
3018+
currRegion.back().getTerminator()))
30163019
return parser.emitError(
30173020
regionLoc, "blocks are expected to be explicitly terminated");
30183021

clang/lib/CodeGen/CGHLSLBuiltins.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) {
160160
return LastInst;
161161
}
162162

163+
static Value *emitBufferStride(CodeGenFunction *CGF, const Expr *HandleExpr,
164+
LValue &Stride) {
165+
// Figure out the stride of the buffer elements from the handle type.
166+
auto *HandleTy =
167+
cast<HLSLAttributedResourceType>(HandleExpr->getType().getTypePtr());
168+
QualType ElementTy = HandleTy->getContainedType();
169+
Value *StrideValue = CGF->getTypeSize(ElementTy);
170+
return CGF->Builder.CreateStore(StrideValue, Stride.getAddress());
171+
}
172+
163173
// Return dot product intrinsic that corresponds to the QT scalar type
164174
static Intrinsic::ID getDotProductIntrinsic(CGHLSLRuntime &RT, QualType QT) {
165175
if (QT->isFloatingType())
@@ -372,6 +382,19 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
372382
RetTy, CGM.getHLSLRuntime().getNonUniformResourceIndexIntrinsic(),
373383
ArrayRef<Value *>{IndexOp});
374384
}
385+
case Builtin::BI__builtin_hlsl_resource_getdimensions_x: {
386+
Value *Handle = EmitScalarExpr(E->getArg(0));
387+
LValue Dim = EmitLValue(E->getArg(1));
388+
llvm::Type *RetTy = llvm::Type::getInt32Ty(getLLVMContext());
389+
Value *DimValue = Builder.CreateIntrinsic(
390+
RetTy, CGM.getHLSLRuntime().getGetDimensionsXIntrinsic(),
391+
ArrayRef<Value *>{Handle});
392+
return Builder.CreateStore(DimValue, Dim.getAddress());
393+
}
394+
case Builtin::BI__builtin_hlsl_resource_getstride: {
395+
LValue Stride = EmitLValue(E->getArg(1));
396+
return emitBufferStride(this, E->getArg(0), Stride);
397+
}
375398
case Builtin::BI__builtin_hlsl_all: {
376399
Value *Op0 = EmitScalarExpr(E->getArg(0));
377400
return Builder.CreateIntrinsic(

0 commit comments

Comments
 (0)