Skip to content

Commit e47f9e7

Browse files
committed
Merge from 'main' to 'sycl-web' (190 commits)
CONFLICT (content): Merge conflict in clang/lib/CodeGen/BackendUtil.cpp
2 parents f084720 + 2978d02 commit e47f9e7

File tree

1,238 files changed

+28432
-16596
lines changed

Some content is hidden

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

1,238 files changed

+28432
-16596
lines changed

bolt/docs/Heatmaps.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ or if you want to monitor the existing process(es):
2020
$ perf record -e cycles:u -j any,u [-p PID|-a] -- sleep <interval>
2121
```
2222

23-
Note that at the moment running with LBR (`-j any,u` or `-b`) is
24-
a requirement.
23+
Running with LBR (`-j any,u` or `-b`) is recommended. Heatmaps can be generated
24+
from basic events by using the llvm-bolt-heatmap option `-nl` (no LBR) but
25+
such heatmaps do not have the coverage provided by LBR and may only be useful
26+
for finding event hotspots at larger code block granularities.
2527

2628
Once the run is complete, and `perf.data` is generated, run llvm-bolt-heatmap:
2729

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,37 +1296,55 @@ std::error_code DataAggregator::printLBRHeatMap() {
12961296
uint64_t NumTotalSamples = 0;
12971297

12981298
while (hasData()) {
1299-
ErrorOr<PerfBranchSample> SampleRes = parseBranchSample();
1300-
if (std::error_code EC = SampleRes.getError()) {
1301-
if (EC == errc::no_such_process)
1302-
continue;
1303-
return EC;
1304-
}
1305-
1306-
PerfBranchSample &Sample = SampleRes.get();
1299+
if (opts::BasicAggregation) {
1300+
ErrorOr<PerfBasicSample> SampleRes = parseBasicSample();
1301+
if (std::error_code EC = SampleRes.getError()) {
1302+
if (EC == errc::no_such_process)
1303+
continue;
1304+
return EC;
1305+
}
1306+
PerfBasicSample &Sample = SampleRes.get();
1307+
HM.registerAddress(Sample.PC);
1308+
NumTotalSamples++;
1309+
} else {
1310+
ErrorOr<PerfBranchSample> SampleRes = parseBranchSample();
1311+
if (std::error_code EC = SampleRes.getError()) {
1312+
if (EC == errc::no_such_process)
1313+
continue;
1314+
return EC;
1315+
}
13071316

1308-
// LBRs are stored in reverse execution order. NextLBR refers to the next
1309-
// executed branch record.
1310-
const LBREntry *NextLBR = nullptr;
1311-
for (const LBREntry &LBR : Sample.LBR) {
1312-
if (NextLBR) {
1313-
// Record fall-through trace.
1314-
const uint64_t TraceFrom = LBR.To;
1315-
const uint64_t TraceTo = NextLBR->From;
1316-
++FallthroughLBRs[Trace(TraceFrom, TraceTo)].InternCount;
1317+
PerfBranchSample &Sample = SampleRes.get();
1318+
1319+
// LBRs are stored in reverse execution order. NextLBR refers to the next
1320+
// executed branch record.
1321+
const LBREntry *NextLBR = nullptr;
1322+
for (const LBREntry &LBR : Sample.LBR) {
1323+
if (NextLBR) {
1324+
// Record fall-through trace.
1325+
const uint64_t TraceFrom = LBR.To;
1326+
const uint64_t TraceTo = NextLBR->From;
1327+
++FallthroughLBRs[Trace(TraceFrom, TraceTo)].InternCount;
1328+
}
1329+
NextLBR = &LBR;
13171330
}
1318-
NextLBR = &LBR;
1319-
}
1320-
if (!Sample.LBR.empty()) {
1321-
HM.registerAddress(Sample.LBR.front().To);
1322-
HM.registerAddress(Sample.LBR.back().From);
1331+
if (!Sample.LBR.empty()) {
1332+
HM.registerAddress(Sample.LBR.front().To);
1333+
HM.registerAddress(Sample.LBR.back().From);
1334+
}
1335+
NumTotalSamples += Sample.LBR.size();
13231336
}
1324-
NumTotalSamples += Sample.LBR.size();
13251337
}
13261338

13271339
if (!NumTotalSamples) {
1328-
errs() << "HEATMAP-ERROR: no LBR traces detected in profile. "
1329-
"Cannot build heatmap.\n";
1340+
if (!opts::BasicAggregation) {
1341+
errs() << "HEATMAP-ERROR: no LBR traces detected in profile. "
1342+
"Cannot build heatmap. Use -nl for building heatmap from "
1343+
"basic events.\n";
1344+
} else {
1345+
errs() << "HEATMAP-ERROR: no samples detected in profile. "
1346+
"Cannot build heatmap.";
1347+
}
13301348
exit(1);
13311349
}
13321350

bolt/tools/merge-fdata/merge-fdata.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ void mergeLegacyProfiles(const cl::list<std::string> &Filenames) {
239239
errs() << "Using legacy profile format.\n";
240240
bool BoltedCollection = false;
241241
bool First = true;
242+
StringMap<uint64_t> Entries;
242243
for (const std::string &Filename : Filenames) {
243244
if (isYAML(Filename))
244245
report_error(Filename, "cannot mix YAML and legacy formats");
@@ -265,9 +266,25 @@ void mergeLegacyProfiles(const cl::list<std::string> &Filenames) {
265266
"cannot mix profile collected in BOLT and non-BOLT deployments");
266267
}
267268

268-
outs() << Buf;
269+
SmallVector<StringRef, 10> Lines;
270+
SplitString(Buf, Lines, "\n");
271+
for (StringRef Line : Lines) {
272+
size_t Pos = Line.rfind(" ");
273+
if (Pos == StringRef::npos)
274+
report_error(Filename, "Malformed / corrupted profile");
275+
StringRef Signature = Line.substr(0, Pos);
276+
uint64_t Count;
277+
if (Line.substr(Pos + 1, Line.size() - Pos).getAsInteger(10, Count))
278+
report_error(Filename, "Malformed / corrupted profile counter");
279+
Count += Entries.lookup(Signature);
280+
Entries.insert_or_assign(Signature, Count);
281+
}
269282
First = false;
270283
}
284+
285+
for (const auto &Entry : Entries)
286+
outs() << Entry.getKey() << " " << Entry.getValue() << "\n";
287+
271288
errs() << "Profile from " << Filenames.size() << " files merged.\n";
272289
}
273290

clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ static bool areEquivalentExpr(const Expr *Left, const Expr *Right) {
134134
return cast<UnaryOperator>(Left)->getOpcode() ==
135135
cast<UnaryOperator>(Right)->getOpcode();
136136
case Stmt::BinaryOperatorClass:
137+
if (cast<BinaryOperator>(Left)->isAssignmentOp())
138+
return false;
137139
return cast<BinaryOperator>(Left)->getOpcode() ==
138140
cast<BinaryOperator>(Right)->getOpcode();
139141
case Stmt::UnaryExprOrTypeTraitExprClass:

clang-tools-extra/clangd/SemanticHighlighting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ bool operator==(const HighlightingToken &L, const HighlightingToken &R) {
912912
std::tie(R.R, R.Kind, R.Modifiers);
913913
}
914914
bool operator<(const HighlightingToken &L, const HighlightingToken &R) {
915-
return std::tie(L.R, L.Kind, R.Modifiers) <
915+
return std::tie(L.R, L.Kind, L.Modifiers) <
916916
std::tie(R.R, R.Kind, R.Modifiers);
917917
}
918918

clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,19 @@ sizeof...($TemplateParameter[[Elements]]);
795795
typedef int $Primitive_decl[[MyTypedef]];
796796
enum $Enum_decl[[MyEnum]] : $Primitive[[MyTypedef]] {};
797797
)cpp",
798-
};
798+
// Issue 1096
799+
R"cpp(
800+
void $Function_decl[[Foo]]();
801+
// Use <: :> digraphs for deprecated attribute to avoid conflict with annotation syntax
802+
<:<:deprecated:>:> void $Function_decl_deprecated[[Foo]](int* $Parameter_decl[[x]]);
803+
void $Function_decl[[Foo]](int $Parameter_decl[[x]]);
804+
template <typename $TemplateParameter_decl[[T]]>
805+
void $Function_decl[[Bar]]($TemplateParameter[[T]] $Parameter_decl[[x]]) {
806+
$Function_deprecated[[Foo]]($Parameter[[x]]);
807+
$Function_deprecated[[Foo]]($Parameter[[x]]);
808+
$Function_deprecated[[Foo]]($Parameter[[x]]);
809+
}
810+
)cpp"};
799811
for (const auto &TestCase : TestCases)
800812
// Mask off scope modifiers to keep the tests manageable.
801813
// They're tested separately.

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Changes in existing checks
132132
the vector is a member of a structure.
133133

134134
- Fixed a false positive in :doc:`readability-non-const-parameter
135-
<clang-tidy/checks/readability-non-const-parameter>` when the parameter is referenced by an lvalue
135+
<clang-tidy/checks/readability-non-const-parameter>` when the parameter is referenced by an lvalue.
136136

137137
- Fixed a crash in :doc:`readability-const-return-type
138138
<clang-tidy/checks/readability-const-return-type>` when a pure virtual function
@@ -150,6 +150,9 @@ Changes in existing checks
150150
Fixed an issue when there was already an initializer in the constructor and
151151
the check would try to create another initializer for the same member.
152152

153+
- Fixed a false positive in :doc:`misc-redundant-expression <clang-tidy/checks/misc-redundant-expression>`
154+
involving assignments in conditions. This fixes `Issue 35853 <https://github.com/llvm/llvm-project/issues/35853>`_.
155+
153156
Removed checks
154157
^^^^^^^^^^^^^^
155158

clang-tools-extra/pseudo/unittests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ clang_target_link_libraries(ClangPseudoTests
1515
PRIVATE
1616
clangBasic
1717
clangLex
18-
clangTesting
1918
)
2019

2120
target_link_libraries(ClangPseudoTests

clang-tools-extra/test/clang-tidy/checkers/misc-redundant-expression.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,3 +831,15 @@ struct Bar2 {
831831
};
832832

833833
} // namespace no_crash
834+
835+
int TestAssignSideEffect(int i) {
836+
int k = i;
837+
838+
if ((k = k + 1) != 1 || (k = k + 1) != 2)
839+
return 0;
840+
841+
if ((k = foo(0)) != 1 || (k = foo(0)) != 2)
842+
return 1;
843+
844+
return 2;
845+
}

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ Bug Fixes
113113
This fixes Issue `Issue 54462 <https://github.com/llvm/llvm-project/issues/54462>`_.
114114
- Statement expressions are now disabled in default arguments in general.
115115
This fixes Issue `Issue 53488 <https://github.com/llvm/llvm-project/issues/53488>`_.
116+
- According to `CWG 1394 <https://wg21.link/cwg1394>`_ and
117+
`C++20 [dcl.fct.def.general]p2 <https://timsong-cpp.github.io/cppwp/n4868/dcl.fct.def#general-2.sentence-3>`_,
118+
Clang should not diagnose incomplete types in function definitions if the function body is "= delete;".
119+
This fixes Issue `Issue 52802 <https://github.com/llvm/llvm-project/issues/52802>`_.
120+
- Unknown type attributes with a ``[[]]`` spelling are no longer diagnosed twice.
121+
This fixes Issue `Issue 54817 <https://github.com/llvm/llvm-project/issues/54817>`_.
116122

117123
Improvements to Clang's diagnostics
118124
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)