Skip to content

Commit 3f0ed02

Browse files
committed
Merge branch 'main' into dealloc-vgprs
2 parents fa7263c + 6c60ead commit 3f0ed02

File tree

282 files changed

+7032
-4652
lines changed

Some content is hidden

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

282 files changed

+7032
-4652
lines changed

bolt/lib/Passes/VeneerElimination.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ Error VeneerElimination::runOnFunctions(BinaryContext &BC) {
7373
continue;
7474

7575
const MCSymbol *TargetSymbol = BC.MIB->getTargetSymbol(Instr, 0);
76-
if (VeneerDestinations.find(TargetSymbol) == VeneerDestinations.end())
76+
auto It = VeneerDestinations.find(TargetSymbol);
77+
if (It == VeneerDestinations.end())
7778
continue;
7879

7980
VeneerCallers++;
80-
BC.MIB->replaceBranchTarget(Instr, VeneerDestinations[TargetSymbol],
81-
BC.Ctx.get());
81+
BC.MIB->replaceBranchTarget(Instr, It->second, BC.Ctx.get());
8282
}
8383
}
8484
}

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ Non-comprehensive list of changes in this release
272272
``__builtin_signbit`` can now be used in constant expressions.
273273
- Plugins can now define custom attributes that apply to statements
274274
as well as declarations.
275+
- ``__builtin_abs`` function can now be used in constant expressions.
275276

276277
New Compiler Flags
277278
------------------
@@ -418,7 +419,7 @@ Improvements to Clang's diagnostics
418419
- The warning for an unsupported type for a named register variable is now phrased ``unsupported type for named register variable``,
419420
instead of ``bad type for named register variable``. This makes it clear that the type is not supported at all, rather than being
420421
suboptimal in some way the error fails to mention (#GH111550).
421-
422+
422423
- Clang now emits a ``-Wdepredcated-literal-operator`` diagnostic, even if the
423424
name was a reserved name, which we improperly allowed to suppress the
424425
diagnostic.
@@ -537,6 +538,7 @@ Bug Fixes to C++ Support
537538
certain situations. (#GH47400), (#GH90896)
538539
- Fix erroneous templated array size calculation leading to crashes in generated code. (#GH41441)
539540
- During the lookup for a base class name, non-type names are ignored. (#GH16855)
541+
- Fix a crash when recovering an invalid expression involving an explicit object member conversion operator. (#GH112559)
540542

541543
Bug Fixes to AST Handling
542544
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang-c/Index.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2980,7 +2980,7 @@ enum CXTypeKind {
29802980
CXType_Atomic = 177,
29812981
CXType_BTFTagAttributed = 178,
29822982

2983-
// HLSL Types
2983+
/* HLSL Types */
29842984
CXType_HLSLResource = 179,
29852985
CXType_HLSLAttributedResource = 180
29862986
};

clang/include/clang/Basic/AArch64SVEACLETypes.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ SVE_VECTOR_TYPE_FLOAT("__clang_svfloat64x2_t", "svfloat64x2_t", SveFloat64x2, Sv
138138

139139
SVE_VECTOR_TYPE_BFLOAT("__clang_svbfloat16x2_t", "svbfloat16x2_t", SveBFloat16x2, SveBFloat16x2Ty, 8, 16, 2)
140140

141+
SVE_VECTOR_TYPE_INT("__clang_svmfloat8x2_t", "svmfloat8x2_t", SveMFloat8x2, SveMFloat8x2Ty, 16, 8, 2, false)
142+
141143
//
142144
// x3
143145
//
@@ -158,6 +160,8 @@ SVE_VECTOR_TYPE_FLOAT("__clang_svfloat64x3_t", "svfloat64x3_t", SveFloat64x3, Sv
158160

159161
SVE_VECTOR_TYPE_BFLOAT("__clang_svbfloat16x3_t", "svbfloat16x3_t", SveBFloat16x3, SveBFloat16x3Ty, 8, 16, 3)
160162

163+
SVE_VECTOR_TYPE_INT("__clang_svmfloat8x3_t", "svmfloat8x3_t", SveMFloat8x3, SveMFloat8x3Ty, 16, 8, 3, false)
164+
161165
//
162166
// x4
163167
//
@@ -178,6 +182,8 @@ SVE_VECTOR_TYPE_FLOAT("__clang_svfloat64x4_t", "svfloat64x4_t", SveFloat64x4, Sv
178182

179183
SVE_VECTOR_TYPE_BFLOAT("__clang_svbfloat16x4_t", "svbfloat16x4_t", SveBFloat16x4, SveBFloat16x4Ty, 8, 16, 4)
180184

185+
SVE_VECTOR_TYPE_INT("__clang_svmfloat8x4_t", "svmfloat8x4_t", SveMFloat8x4, SveMFloat8x4Ty, 16, 8, 4, false)
186+
181187
SVE_PREDICATE_TYPE_ALL("__SVBool_t", "__SVBool_t", SveBool, SveBoolTy, 16, 1)
182188
SVE_PREDICATE_TYPE_ALL("__clang_svboolx2_t", "svboolx2_t", SveBoolx2, SveBoolx2Ty, 16, 2)
183189
SVE_PREDICATE_TYPE_ALL("__clang_svboolx4_t", "svboolx4_t", SveBoolx4, SveBoolx4Ty, 16, 4)

clang/include/clang/Basic/Builtins.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,6 +2714,7 @@ def Abs : IntMathTemplate, LibBuiltin<"stdlib.h"> {
27142714
let Attributes = [NoThrow, Const];
27152715
let Prototype = "T(T)";
27162716
let AddBuiltinPrefixedAlias = 1;
2717+
let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
27172718
}
27182719

27192720
def Calloc : LibBuiltin<"stdlib.h"> {
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//===--- StackExhaustionHandler.h - A utility for warning once when close to out
2+
// of stack space -------*- C++ -*-===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
///
10+
/// \file
11+
/// Defines a utilitiy for warning once when close to out of stack space.
12+
///
13+
//===----------------------------------------------------------------------===//
14+
15+
#ifndef LLVM_CLANG_BASIC_STACK_EXHAUSTION_HANDLER_H
16+
#define LLVM_CLANG_BASIC_STACK_EXHAUSTION_HANDLER_H
17+
18+
#include "clang/Basic/Diagnostic.h"
19+
20+
namespace clang {
21+
class StackExhaustionHandler {
22+
public:
23+
StackExhaustionHandler(DiagnosticsEngine &diags) : DiagsRef(diags) {}
24+
25+
/// Run some code with "sufficient" stack space. (Currently, at least 256K
26+
/// is guaranteed). Produces a warning if we're low on stack space and
27+
/// allocates more in that case. Use this in code that may recurse deeply to
28+
/// avoid stack overflow.
29+
void runWithSufficientStackSpace(SourceLocation Loc,
30+
llvm::function_ref<void()> Fn);
31+
32+
/// Check to see if we're low on stack space and produce a warning if we're
33+
/// low on stack space (Currently, at least 256Kis guaranteed).
34+
void warnOnStackNearlyExhausted(SourceLocation Loc);
35+
36+
private:
37+
/// Warn that the stack is nearly exhausted.
38+
void warnStackExhausted(SourceLocation Loc);
39+
40+
DiagnosticsEngine &DiagsRef;
41+
bool WarnedStackExhausted = false;
42+
};
43+
} // end namespace clang
44+
45+
#endif // LLVM_CLANG_BASIC_STACK_EXHAUSTION_HANDLER_H

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "clang/Basic/PragmaKinds.h"
5050
#include "clang/Basic/SourceLocation.h"
5151
#include "clang/Basic/Specifiers.h"
52+
#include "clang/Basic/StackExhaustionHandler.h"
5253
#include "clang/Basic/TemplateKinds.h"
5354
#include "clang/Basic/TokenKinds.h"
5455
#include "clang/Basic/TypeTraits.h"
@@ -546,9 +547,6 @@ class Sema final : public SemaBase {
546547
/// Print out statistics about the semantic analysis.
547548
void PrintStats() const;
548549

549-
/// Warn that the stack is nearly exhausted.
550-
void warnStackExhausted(SourceLocation Loc);
551-
552550
/// Run some code with "sufficient" stack space. (Currently, at least 256K is
553551
/// guaranteed). Produces a warning if we're low on stack space and allocates
554552
/// more in that case. Use this in code that may recurse deeply (for example,
@@ -1183,7 +1181,7 @@ class Sema final : public SemaBase {
11831181
std::optional<std::unique_ptr<DarwinSDKInfo>> CachedDarwinSDKInfo;
11841182
bool WarnedDarwinSDKInfoMissing = false;
11851183

1186-
bool WarnedStackExhausted = false;
1184+
StackExhaustionHandler StackHandler;
11871185

11881186
Sema(const Sema &) = delete;
11891187
void operator=(const Sema &) = delete;

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ enum PredefinedTypeIDs {
11491149
///
11501150
/// Type IDs for non-predefined types will start at
11511151
/// NUM_PREDEF_TYPE_IDs.
1152-
const unsigned NUM_PREDEF_TYPE_IDS = 506;
1152+
const unsigned NUM_PREDEF_TYPE_IDS = 509;
11531153

11541154
// Ensure we do not overrun the predefined types we reserved
11551155
// in the enum PredefinedTypeIDs above.

clang/include/clang/Serialization/ASTReader.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "clang/Basic/IdentifierTable.h"
2020
#include "clang/Basic/OpenCLOptions.h"
2121
#include "clang/Basic/SourceLocation.h"
22+
#include "clang/Basic/StackExhaustionHandler.h"
2223
#include "clang/Basic/Version.h"
2324
#include "clang/Lex/ExternalPreprocessorSource.h"
2425
#include "clang/Lex/HeaderSearch.h"
@@ -445,7 +446,7 @@ class ASTReader
445446
DiagnosticsEngine &Diags;
446447
// Sema has duplicate logic, but SemaObj can sometimes be null so ASTReader
447448
// has its own version.
448-
bool WarnedStackExhausted = false;
449+
StackExhaustionHandler StackHandler;
449450

450451
/// The semantic analysis object that will be processing the
451452
/// AST files and the translation unit that uses it.
@@ -2180,7 +2181,8 @@ class ASTReader
21802181
/// Report a diagnostic.
21812182
DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const;
21822183

2183-
void warnStackExhausted(SourceLocation Loc);
2184+
void runWithSufficientStackSpace(SourceLocation Loc,
2185+
llvm::function_ref<void()> Fn);
21842186

21852187
IdentifierInfo *DecodeIdentifierInfo(serialization::IdentifierID ID);
21862188

clang/lib/AST/ASTImporter.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -362,24 +362,24 @@ namespace clang {
362362
template <typename TemplateParmDeclT>
363363
Error importTemplateParameterDefaultArgument(const TemplateParmDeclT *D,
364364
TemplateParmDeclT *ToD) {
365-
Error Err = Error::success();
366365
if (D->hasDefaultArgument()) {
367366
if (D->defaultArgumentWasInherited()) {
368-
auto *ToInheritedFrom = const_cast<TemplateParmDeclT *>(
369-
importChecked(Err, D->getDefaultArgStorage().getInheritedFrom()));
370-
if (Err)
371-
return Err;
367+
Expected<TemplateParmDeclT *> ToInheritedFromOrErr =
368+
import(D->getDefaultArgStorage().getInheritedFrom());
369+
if (!ToInheritedFromOrErr)
370+
return ToInheritedFromOrErr.takeError();
371+
TemplateParmDeclT *ToInheritedFrom = *ToInheritedFromOrErr;
372372
if (!ToInheritedFrom->hasDefaultArgument()) {
373373
// Resolve possible circular dependency between default value of the
374374
// template argument and the template declaration.
375-
const auto ToInheritedDefaultArg =
376-
importChecked(Err, D->getDefaultArgStorage()
377-
.getInheritedFrom()
378-
->getDefaultArgument());
379-
if (Err)
380-
return Err;
375+
Expected<TemplateArgumentLoc> ToInheritedDefaultArgOrErr =
376+
import(D->getDefaultArgStorage()
377+
.getInheritedFrom()
378+
->getDefaultArgument());
379+
if (!ToInheritedDefaultArgOrErr)
380+
return ToInheritedDefaultArgOrErr.takeError();
381381
ToInheritedFrom->setDefaultArgument(Importer.getToContext(),
382-
ToInheritedDefaultArg);
382+
*ToInheritedDefaultArgOrErr);
383383
}
384384
ToD->setInheritedDefaultArgument(ToD->getASTContext(),
385385
ToInheritedFrom);
@@ -395,7 +395,7 @@ namespace clang {
395395
*ToDefaultArgOrErr);
396396
}
397397
}
398-
return Err;
398+
return Error::success();
399399
}
400400

401401
public:

0 commit comments

Comments
 (0)