Skip to content

Commit 0b899a3

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr/zdinx-early-split
2 parents 83f0620 + 864f0ff commit 0b899a3

File tree

739 files changed

+667657
-207406
lines changed

Some content is hidden

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

739 files changed

+667657
-207406
lines changed

bolt/include/bolt/Profile/Heatmap.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class Heatmap {
5252
: BucketSize(BucketSize), MinAddress(MinAddress), MaxAddress(MaxAddress),
5353
TextSections(TextSections) {}
5454

55+
uint64_t HotStart{0};
56+
uint64_t HotEnd{0};
57+
5558
inline bool ignoreAddress(uint64_t Address) const {
5659
return (Address > MaxAddress) || (Address < MinAddress);
5760
}

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,14 @@ std::error_code DataAggregator::printLBRHeatMap() {
13161316
}
13171317
Heatmap HM(opts::HeatmapBlock, opts::HeatmapMinAddress,
13181318
opts::HeatmapMaxAddress, getTextSections(BC));
1319+
auto getSymbolValue = [&](const MCSymbol *Symbol) -> uint64_t {
1320+
if (Symbol)
1321+
if (ErrorOr<uint64_t> SymValue = BC->getSymbolValue(*Symbol))
1322+
return SymValue.get();
1323+
return 0;
1324+
};
1325+
HM.HotStart = getSymbolValue(BC->getHotTextStartSymbol());
1326+
HM.HotEnd = getSymbolValue(BC->getHotTextEndSymbol());
13191327

13201328
if (!NumTotalSamples) {
13211329
if (opts::BasicAggregation) {

bolt/lib/Profile/Heatmap.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "bolt/Profile/Heatmap.h"
1010
#include "bolt/Utils/CommandLineOpts.h"
11+
#include "llvm/ADT/AddressRanges.h"
1112
#include "llvm/ADT/StringMap.h"
1213
#include "llvm/ADT/Twine.h"
1314
#include "llvm/Support/Debug.h"
@@ -313,6 +314,9 @@ void Heatmap::printSectionHotness(raw_ostream &OS) const {
313314
UnmappedHotness += Frequency;
314315
};
315316

317+
AddressRange HotTextRange(HotStart, HotEnd);
318+
StringRef HotTextName = "[hot text]";
319+
316320
for (const std::pair<const uint64_t, uint64_t> &KV : Map) {
317321
NumTotalCounts += KV.second;
318322
// We map an address bucket to the first section (lowest address)
@@ -328,15 +332,24 @@ void Heatmap::printSectionHotness(raw_ostream &OS) const {
328332
}
329333
SectionHotness[TextSections[TextSectionIndex].Name] += KV.second;
330334
++BucketUtilization[TextSections[TextSectionIndex].Name];
335+
if (HotTextRange.contains(Address)) {
336+
SectionHotness[HotTextName] += KV.second;
337+
++BucketUtilization[HotTextName];
338+
}
331339
}
332340

341+
std::vector<SectionNameAndRange> Sections(TextSections);
342+
// Append synthetic hot text section to TextSections
343+
if (!HotTextRange.empty())
344+
Sections.emplace_back(SectionNameAndRange{HotTextName, HotStart, HotEnd});
345+
333346
assert(NumTotalCounts > 0 &&
334347
"total number of heatmap buckets should be greater than 0");
335348

336349
OS << "Section Name, Begin Address, End Address, Percentage Hotness, "
337350
<< "Utilization Pct, Partition Score\n";
338351
const uint64_t MappedCounts = NumTotalCounts - UnmappedHotness;
339-
for (const auto [Name, Begin, End] : TextSections) {
352+
for (const auto [Name, Begin, End] : Sections) {
340353
const float Hotness = 1. * SectionHotness[Name] / NumTotalCounts;
341354
const float MappedHotness =
342355
MappedCounts ? 1. * SectionHotness[Name] / MappedCounts : 0;

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,8 +968,9 @@ void RewriteInstance::discoverFileObjects() {
968968
continue;
969969
}
970970

971-
// Ignore input hot markers
972-
if (SymName == "__hot_start" || SymName == "__hot_end")
971+
// Ignore input hot markers unless in heatmap mode
972+
if ((SymName == "__hot_start" || SymName == "__hot_end") &&
973+
!opts::HeatmapMode)
973974
continue;
974975

975976
FileSymRefs.emplace(SymbolAddress, Symbol);

bolt/test/X86/callcont-fallthru.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# RUN: %clangxx %cxxflags %s %t.so -o %t -Wl,-q -nostdlib
77
# RUN: link_fdata %s %t %t.pat PREAGGT1
88
# RUN: link_fdata %s %t %t.pat2 PREAGGT2
9-
# RUN: link_fdata %s %t %t.patplt PREAGGPLT
9+
# DONTRUN: link_fdata %s %t %t.patplt PREAGGPLT
1010

1111
# RUN: llvm-strip --strip-unneeded %t -o %t.strip
1212
# RUN: llvm-objcopy --remove-section=.eh_frame %t.strip %t.noeh
@@ -26,8 +26,8 @@
2626

2727
## Check pre-aggregated traces don't report zero-sized PLT fall-through as
2828
## invalid trace
29-
# RUN: llvm-bolt %t.strip --pa -p %t.patplt -o %t.out | FileCheck %s \
30-
# RUN: --check-prefix=CHECK-PLT
29+
# DONTRUN: llvm-bolt %t.strip --pa -p %t.patplt -o %t.out | FileCheck %s \
30+
# DONTRUN: --check-prefix=CHECK-PLT
3131
# CHECK-PLT: traces mismatching disassembled function contents: 0
3232

3333
.globl foo

bolt/test/X86/heatmap-preagg.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ RUN: --reorder-functions=cdsort --enable-bat --dyno-stats --skip-funcs=main
1313
RUN: llvm-bolt-heatmap %t.out -o %t2 --pa -p %p/Inputs/blarge_new_bat.preagg.txt \
1414
RUN: 2>&1 | FileCheck --check-prefix CHECK-HEATMAP-BAT %s
1515
RUN: FileCheck %s --check-prefix CHECK-SEC-HOT-BAT --input-file %t2-section-hotness.csv
16+
RUN: llvm-nm -n %t.out | FileCheck %s --check-prefix=CHECK-HOT-SYMS
1617

1718
CHECK-HEATMAP: PERF2BOLT: read 81 aggregated LBR entries
1819
CHECK-HEATMAP: HEATMAP: invalid traces: 1
@@ -33,3 +34,6 @@ CHECK-SEC-HOT-BAT-NEXT: .bolt.org.text, 0x4010b0, 0x401c25, 38.3385, 51.0638, 0.
3334
CHECK-SEC-HOT-BAT-NEXT: .fini, 0x401c28, 0x401c35, 0.0000, 0.0000, 0.0000
3435
CHECK-SEC-HOT-BAT-NEXT: .text, 0x800000, 0x8002cc, 38.7595, 91.6667, 0.3553
3536
CHECK-SEC-HOT-BAT-NEXT: .text.cold, 0x800300, 0x800415, 0.0000, 0.0000, 0.0000
37+
CHECK-SEC-HOT-BAT-NEXT: [hot text], 0x800000, 0x8002cc, 38.7595, 91.6667, 0.3553
38+
CHECK-HOT-SYMS: 800000 W __hot_start
39+
CHECK-HOT-SYMS: 8002cc W __hot_end

clang/docs/CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,34 @@ if (LLVM_ENABLE_SPHINX)
134134
gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}")
135135
gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td "${docs_targets}")
136136

137+
# Another generated file from a different source
138+
set(docs_tools_dir ${CMAKE_CURRENT_SOURCE_DIR}/tools)
139+
set(aopts_rst_rel_path analyzer/user-docs/Options.rst)
140+
set(aopts_rst "${CMAKE_CURRENT_BINARY_DIR}/${aopts_rst_rel_path}")
141+
set(analyzeroptions_def "${CMAKE_CURRENT_SOURCE_DIR}/../include/clang/StaticAnalyzer/Core/AnalyzerOptions.def")
142+
set(aopts_rst_in "${CMAKE_CURRENT_SOURCE_DIR}/${aopts_rst_rel_path}.in")
143+
add_custom_command(
144+
OUTPUT ${aopts_rst}
145+
COMMAND ${Python3_EXECUTABLE} generate_analyzer_options_docs.py
146+
--options-def "${analyzeroptions_def}"
147+
--template "${aopts_rst_in}"
148+
--out "${aopts_rst}"
149+
WORKING_DIRECTORY ${docs_tools_dir}
150+
VERBATIM
151+
COMMENT "Generating ${aopts_rst}"
152+
DEPENDS ${docs_tools_dir}/${generate_aopts_docs}
153+
${aopts_rst_in}
154+
copy-clang-rst-docs
155+
)
156+
add_custom_target(generate-analyzer-options-rst DEPENDS ${aopts_rst})
157+
foreach(target ${docs_targets})
158+
add_dependencies(${target} generate-analyzer-options-rst)
159+
endforeach()
160+
161+
# Technically this is redundant because generate-analyzer-options-rst
162+
# depends on the copy operation (because it wants to drop a generated file
163+
# into a subdirectory of the copied tree), but I'm leaving it here for the
164+
# sake of clarity.
137165
foreach(target ${docs_targets})
138166
add_dependencies(${target} copy-clang-rst-docs)
139167
endforeach()

clang/docs/ReleaseNotes.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ C++ Specific Potentially Breaking Changes
5858
- The type trait builtin ``__is_referenceable`` has been removed, since it has
5959
very few users and all the type traits that could benefit from it in the
6060
standard library already have their own bespoke builtins.
61+
- A workaround for libstdc++4.7 has been removed. Note that 4.8.3 remains the oldest
62+
supported libstdc++ version.
6163

6264
ABI Changes in This Version
6365
---------------------------
@@ -118,6 +120,9 @@ C++23 Feature Support
118120

119121
C++20 Feature Support
120122
^^^^^^^^^^^^^^^^^^^^^
123+
- Fixed a crash with a defaulted spaceship (``<=>``) operator when the class
124+
contains a member declaration of vector type. Vector types cannot yet be
125+
compared directly, so this causes the operator to be deleted. (#GH137452)
121126

122127
C++17 Feature Support
123128
^^^^^^^^^^^^^^^^^^^^^
@@ -520,9 +525,10 @@ Improvements to Clang's diagnostics
520525

521526
- Fixed a duplicate diagnostic when performing typo correction on function template
522527
calls with explicit template arguments. (#GH139226)
523-
524-
- An error is now emitted when OpenMP ``collapse`` and ``ordered`` clauses have an
525-
argument larger than what can fit within a 64-bit integer.
528+
529+
- Explanatory note is printed when ``assert`` fails during evaluation of a
530+
constant expression. Prior to this, the error inaccurately implied that assert
531+
could not be used at all in a constant expression (#GH130458)
526532

527533
- A new off-by-default warning ``-Wms-bitfield-padding`` has been added to alert to cases where bit-field
528534
packing may differ under the MS struct ABI (#GH117428).
@@ -586,6 +592,8 @@ Bug Fixes in This Version
586592
``#include`` directive. (#GH138094)
587593
- Fixed a crash during constant evaluation involving invalid lambda captures
588594
(#GH138832)
595+
- Fixed a crash when instantiating an invalid dependent friend template specialization.
596+
(#GH139052)
589597
- Fixed a crash with an invalid member function parameter list with a default
590598
argument which contains a pragma. (#GH113722)
591599
- Fixed assertion failures when generating name lookup table in modules. (#GH61065, #GH134739)
@@ -935,6 +943,12 @@ OpenMP Support
935943
- Fixed a crashing bug with a malformed ``cancel`` directive. (#GH139360)
936944
- Fixed a crashing bug with ``omp distribute dist_schedule`` if the argument to
937945
``dist_schedule`` was not strictly positive. (#GH139266)
946+
- Fixed two crashing bugs with a malformed ``metadirective`` directive. One was
947+
a crash if the next token after ``metadirective`` was a paren, bracket, or
948+
brace. The other was if the next token after the meta directive was not an
949+
open parenthesis. (#GH139665)
950+
- An error is now emitted when OpenMP ``collapse`` and ``ordered`` clauses have
951+
an argument larger than what can fit within a 64-bit integer.
938952

939953
Improvements
940954
^^^^^^^^^^^^

clang/docs/UsersManual.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2792,6 +2792,9 @@ usual build cycle when using sample profilers for optimization:
27922792
27932793
$ llvm-profgen --binary=./code --output=code.prof --perfdata=perf.data
27942794
2795+
Please note, ``perf.data`` must be collected with ``-b`` flag to Linux ``perf``
2796+
for the above step to work.
2797+
27952798
When using SEP the output is in the textual format corresponding to
27962799
``llvm-profgen --perfscript``. For example:
27972800

clang/docs/analyzer/user-docs.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Contents:
88

99
user-docs/Installation
1010
user-docs/CommandLineUsage
11+
user-docs/Options
1112
user-docs/UsingWithXCode
1213
user-docs/FilingBugs
1314
user-docs/CrossTranslationUnit

0 commit comments

Comments
 (0)