Skip to content

Commit 7e15580

Browse files
authored
Merge branch 'main' into main
2 parents 9ec2672 + 1e4a54b commit 7e15580

File tree

320 files changed

+12426
-2106
lines changed

Some content is hidden

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

320 files changed

+12426
-2106
lines changed

.ci/metrics/metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
GITHUB_JOB_TO_TRACK = {
4141
"github_llvm_premerge_checks": {
4242
"Build and Test Linux": "premerge_linux",
43+
"Build and Test Linux AArch64": "premerge_linux_aarch64",
4344
"Build and Test Windows": "premerge_windows",
4445
},
4546
"github_libcxx_premerge_checks": {

.github/workflows/containers/github-action-ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM docker.io/library/ubuntu:24.04 AS base
22
ENV LLVM_SYSROOT=/opt/llvm
33

44
FROM base AS stage1-toolchain
5-
ENV LLVM_VERSION=21.1.1
5+
ENV LLVM_VERSION=21.1.3
66

77
RUN apt-get update && \
88
apt-get install -y \

bolt/lib/Passes/FrameAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class FrameAccessAnalysis {
198198
if (CFIStack.empty())
199199
dbgs() << "Assertion is about to fail: " << BF.getPrintName() << "\n";
200200
assert(!CFIStack.empty() && "Corrupt CFI stack");
201-
std::pair<int64_t, uint16_t> &Elem = CFIStack.top();
201+
std::pair<int64_t, uint16_t> Elem = CFIStack.top();
202202
CFIStack.pop();
203203
CfaOffset = Elem.first;
204204
CfaReg = Elem.second;

bolt/lib/Passes/ShrinkWrapping.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ void StackLayoutModifier::classifyCFIs() {
402402
break;
403403
case MCCFIInstruction::OpRestoreState: {
404404
assert(!CFIStack.empty() && "Corrupt CFI stack");
405-
std::pair<int64_t, uint16_t> &Elem = CFIStack.top();
405+
std::pair<int64_t, uint16_t> Elem = CFIStack.top();
406406
CFIStack.pop();
407407
CfaOffset = Elem.first;
408408
CfaReg = Elem.second;

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,16 +1040,11 @@ class ExplicitReferenceCollector
10401040
if (auto *S = N.get<Stmt>())
10411041
return refInStmt(S, Resolver);
10421042
if (auto *NNSL = N.get<NestedNameSpecifierLoc>()) {
1043+
if (auto TL = NNSL->getAsTypeLoc())
1044+
return refInTypeLoc(NNSL->getAsTypeLoc(), Resolver);
10431045
// (!) 'DeclRelation::Alias' ensures we do not lose namespace aliases.
1044-
NestedNameSpecifierLoc Qualifier;
1045-
SourceLocation NameLoc;
1046-
if (auto TL = NNSL->getAsTypeLoc()) {
1047-
Qualifier = TL.getPrefix();
1048-
NameLoc = TL.getNonPrefixBeginLoc();
1049-
} else {
1050-
Qualifier = NNSL->getAsNamespaceAndPrefix().Prefix;
1051-
NameLoc = NNSL->getLocalBeginLoc();
1052-
}
1046+
NestedNameSpecifierLoc Qualifier = NNSL->getAsNamespaceAndPrefix().Prefix;
1047+
SourceLocation NameLoc = NNSL->getLocalBeginLoc();
10531048
return {
10541049
ReferenceLoc{Qualifier, NameLoc, false,
10551050
explicitReferenceTargets(

clang/docs/OpenMPSupport.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ implementation.
505505
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
506506
| pure directives in DO CONCURRENT | | :none:`unclaimed` | |
507507
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
508-
| Optional argument for all clauses | :none:`unclaimed` | :none:`unclaimed` | |
508+
| Optional argument for all clauses | :none:`partial` | :none:`In Progress` | Parse/Sema (nowait): https://github.com/llvm/llvm-project/pull/159628 |
509509
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
510510
| Function references for locator list items | :none:`unclaimed` | :none:`unclaimed` | |
511511
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Deprecated Compiler Flags
286286
Modified Compiler Flags
287287
-----------------------
288288
- The `-gkey-instructions` compiler flag is now enabled by default when DWARF is emitted for plain C/C++ and optimizations are enabled. (#GH149509)
289+
- The `-fconstexpr-steps` compiler flag now accepts value `0` to opt out of this limit. (#GH160440)
289290

290291
Removed Compiler Flags
291292
-------------------------
@@ -640,6 +641,8 @@ OpenMP Support
640641
- Added support for ``defaultmap`` directive implicit-behavior ``private``.
641642
- Added parsing and semantic analysis support for ``groupprivate`` directive.
642643
- Added support for 'omp fuse' directive.
644+
- Updated parsing and semantic analysis support for ``nowait`` clause to accept
645+
optional argument in OpenMP >= 60.
643646

644647
Improvements
645648
^^^^^^^^^^^^

clang/docs/UsersManual.rst

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2780,6 +2780,25 @@ usual build cycle when using sample profilers for optimization:
27802780
/clang:-fdebug-info-for-profiling /clang:-funique-internal-linkage-names ^
27812781
code.cc /Fe:code -fuse-ld=lld /link /debug:dwarf
27822782
2783+
[OPTIONAL] Pseudo instrumentation can be used as the anchor for accurate
2784+
profile mapping with the ``-fpseudo-probe-for-profiling`` option.
2785+
2786+
On Linux:
2787+
2788+
.. code-block:: console
2789+
2790+
$ clang++ -O2 -gline-tables-only \
2791+
-fpseudo-probe-for-profiling -funique-internal-linkage-names \
2792+
code.cc -o code
2793+
2794+
On Windows:
2795+
2796+
.. code-block:: winbatch
2797+
2798+
> clang-cl /O2 -gdwarf -gline-tables-only ^
2799+
-fpseudo-probe-for-profiling /clang:-funique-internal-linkage-names ^
2800+
code.cc /Fe:code -fuse-ld=lld /link /debug:dwarf
2801+
27832802
.. note::
27842803

27852804
:ref:`-funique-internal-linkage-names <funique_internal_linkage_names>`
@@ -2881,6 +2900,25 @@ usual build cycle when using sample profilers for optimization:
28812900
/clang:-fdebug-info-for-profiling /clang:-funique-internal-linkage-names ^
28822901
-fprofile-sample-use=code.prof code.cc /Fe:code
28832902
2903+
[OPTIONAL] Pseudo instrumentation can be used as the anchor for accurate
2904+
profile mapping with the ``-fpseudo-probe-for-profiling`` option.
2905+
2906+
On Linux:
2907+
2908+
.. code-block:: console
2909+
2910+
$ clang++ -O2 \
2911+
-fpseudo-probe-for-profiling -funique-internal-linkage-names \
2912+
-fprofile-sample-use=code.prof code.cc -o code
2913+
2914+
On Windows:
2915+
2916+
.. code-block:: winbatch
2917+
2918+
> clang-cl /O2 ^
2919+
-fpseudo-probe-for-profiling /clang:-funique-internal-linkage-names ^
2920+
-fprofile-sample-use=code.prof code.cc /Fe:code
2921+
28842922
[OPTIONAL] Sampling-based profiles can have inaccuracies or missing block/
28852923
edge counters. The profile inference algorithm (profi) can be used to infer
28862924
missing blocks and edge counts, and improve the quality of profile data.
@@ -4036,7 +4074,7 @@ Controlling implementation limits
40364074
Sets the limit for the number of full-expressions evaluated in a single
40374075
constant expression evaluation. This also controls the maximum size
40384076
of array and dynamic array allocation that can be constant evaluated.
4039-
The default is 1048576.
4077+
The default is 1048576, and the limit can be disabled with `-fconstexpr-steps=0`.
40404078

40414079
.. option:: -ftemplate-depth=N
40424080

clang/include/clang/AST/NestedNameSpecifierBase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ class NestedNameSpecifierLoc {
361361
/// Retrieve the source range covering just the last part of
362362
/// this nested-name-specifier, not including the prefix.
363363
///
364+
/// Note that this is the source range of this NestedNameSpecifier chunk,
365+
/// and for a type this includes the prefix of that type.
366+
///
364367
/// For example, if this instance refers to a nested-name-specifier
365368
/// \c \::std::vector<int>::, the returned source range would cover
366369
/// from "vector" to the last '::'.

clang/include/clang/AST/OpenACCClause.h

Lines changed: 69 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ class OpenACCCreateClause final
12771277
};
12781278

12791279
// A structure to stand in for the recipe on a reduction. RecipeDecl is the
1280-
// 'main' declaration used for initializaiton, which is fixed.
1280+
// 'main' declaration used for initializaiton, which is fixed.
12811281
struct OpenACCReductionRecipe {
12821282
VarDecl *AllocaDecl;
12831283

@@ -1297,41 +1297,92 @@ struct OpenACCReductionRecipe {
12971297
// -For a struct without the operator, this will be 1 element per field, which
12981298
// should be the combiner for that element.
12991299
// -For an array of any of the above, it will be the above for the element.
1300-
llvm::SmallVector<CombinerRecipe, 1> CombinerRecipes;
1300+
// Note: These are necessarily stored in either Trailing Storage (when in the
1301+
// AST), or in a separate collection when being semantically analyzed.
1302+
llvm::ArrayRef<CombinerRecipe> CombinerRecipes;
13011303

13021304
OpenACCReductionRecipe(VarDecl *A, llvm::ArrayRef<CombinerRecipe> Combiners)
13031305
: AllocaDecl(A), CombinerRecipes(Combiners) {}
13041306

13051307
bool isSet() const { return AllocaDecl; }
1306-
static OpenACCReductionRecipe Empty() {
1307-
return OpenACCReductionRecipe(/*AllocaDecl=*/nullptr, {});
1308+
};
1309+
1310+
// A version of the above that is used for semantic analysis, at a time before
1311+
// the OpenACCReductionClause node has been created. This one has storage for
1312+
// the CombinerRecipe, since Trailing storage for it doesn't exist yet.
1313+
struct OpenACCReductionRecipeWithStorage : OpenACCReductionRecipe {
1314+
private:
1315+
llvm::SmallVector<CombinerRecipe, 1> CombinerRecipeStorage;
1316+
1317+
public:
1318+
OpenACCReductionRecipeWithStorage(VarDecl *A,
1319+
llvm::ArrayRef<CombinerRecipe> Combiners)
1320+
: OpenACCReductionRecipe(A, {}), CombinerRecipeStorage(Combiners) {
1321+
CombinerRecipes = CombinerRecipeStorage;
1322+
}
1323+
1324+
OpenACCReductionRecipeWithStorage(
1325+
const OpenACCReductionRecipeWithStorage &Other)
1326+
: OpenACCReductionRecipe(Other),
1327+
CombinerRecipeStorage(Other.CombinerRecipeStorage) {
1328+
CombinerRecipes = CombinerRecipeStorage;
1329+
}
1330+
1331+
OpenACCReductionRecipeWithStorage(OpenACCReductionRecipeWithStorage &&Other)
1332+
: OpenACCReductionRecipe(std::move(Other)),
1333+
CombinerRecipeStorage(std::move(Other.CombinerRecipeStorage)) {
1334+
CombinerRecipes = CombinerRecipeStorage;
1335+
}
1336+
1337+
// There is no real problem implementing these, we just have to make sure the
1338+
// array-ref this inherits from stays in sync. But as we don't need it at the
1339+
// moment, make sure we don't accidentially call these.
1340+
OpenACCReductionRecipeWithStorage &
1341+
operator=(OpenACCReductionRecipeWithStorage &&) = delete;
1342+
OpenACCReductionRecipeWithStorage &
1343+
operator=(const OpenACCReductionRecipeWithStorage &) = delete;
1344+
1345+
static OpenACCReductionRecipeWithStorage Empty() {
1346+
return OpenACCReductionRecipeWithStorage(/*AllocaDecl=*/nullptr, {});
13081347
}
13091348
};
13101349

13111350
class OpenACCReductionClause final
13121351
: public OpenACCClauseWithVarList,
13131352
private llvm::TrailingObjects<OpenACCReductionClause, Expr *,
1314-
OpenACCReductionRecipe> {
1353+
OpenACCReductionRecipe,
1354+
OpenACCReductionRecipe::CombinerRecipe> {
13151355
friend TrailingObjects;
13161356
OpenACCReductionOperator Op;
13171357

13181358
OpenACCReductionClause(SourceLocation BeginLoc, SourceLocation LParenLoc,
13191359
OpenACCReductionOperator Operator,
13201360
ArrayRef<Expr *> VarList,
1321-
ArrayRef<OpenACCReductionRecipe> Recipes,
1361+
ArrayRef<OpenACCReductionRecipeWithStorage> Recipes,
13221362
SourceLocation EndLoc)
13231363
: OpenACCClauseWithVarList(OpenACCClauseKind::Reduction, BeginLoc,
13241364
LParenLoc, EndLoc),
13251365
Op(Operator) {
1326-
assert(VarList.size() == Recipes.size());
1366+
assert(VarList.size() == Recipes.size());
13271367
setExprs(getTrailingObjects<Expr *>(VarList.size()), VarList);
13281368

1329-
// Initialize the recipe list.
1330-
unsigned I = 0;
1331-
for (const OpenACCReductionRecipe &R : Recipes) {
1332-
new (&getTrailingObjects<OpenACCReductionRecipe>()[I])
1333-
OpenACCReductionRecipe(R);
1334-
++I;
1369+
// Since we're using trailing storage on this node to store the 'combiner'
1370+
// recipes of the Reduction Recipes (which have a 1:M relationship), we need
1371+
// to ensure we get the ArrayRef of each of our combiner 'correct'.
1372+
OpenACCReductionRecipe::CombinerRecipe *CurCombinerLoc =
1373+
getTrailingObjects<OpenACCReductionRecipe::CombinerRecipe>();
1374+
for (const auto &[Idx, R] : llvm::enumerate(Recipes)) {
1375+
1376+
// ArrayRef to the 'correct' data location in trailing storage.
1377+
llvm::MutableArrayRef<OpenACCReductionRecipe::CombinerRecipe>
1378+
NewCombiners{CurCombinerLoc, R.CombinerRecipes.size()};
1379+
CurCombinerLoc += R.CombinerRecipes.size();
1380+
1381+
llvm::uninitialized_copy(R.CombinerRecipes, NewCombiners.begin());
1382+
1383+
// Placement new into the correct location in trailng storage.
1384+
new (&getTrailingObjects<OpenACCReductionRecipe>()[Idx])
1385+
OpenACCReductionRecipe(R.AllocaDecl, NewCombiners);
13351386
}
13361387
}
13371388

@@ -1353,13 +1404,17 @@ class OpenACCReductionClause final
13531404
static OpenACCReductionClause *
13541405
Create(const ASTContext &C, SourceLocation BeginLoc, SourceLocation LParenLoc,
13551406
OpenACCReductionOperator Operator, ArrayRef<Expr *> VarList,
1356-
ArrayRef<OpenACCReductionRecipe> Recipes, SourceLocation EndLoc);
1407+
ArrayRef<OpenACCReductionRecipeWithStorage> Recipes,
1408+
SourceLocation EndLoc);
13571409

13581410
OpenACCReductionOperator getReductionOp() const { return Op; }
13591411

13601412
size_t numTrailingObjects(OverloadToken<Expr *>) const {
13611413
return getExprs().size();
13621414
}
1415+
size_t numTrailingObjects(OverloadToken<OpenACCReductionRecipe>) const {
1416+
return getExprs().size();
1417+
}
13631418
};
13641419

13651420
class OpenACCLinkClause final

0 commit comments

Comments
 (0)