Skip to content

Convert SpecialCaseList::Sections from StringMap to vector. #140115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions bolt/include/bolt/Profile/Heatmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ class Heatmap {
: BucketSize(BucketSize), MinAddress(MinAddress), MaxAddress(MaxAddress),
TextSections(TextSections) {}

uint64_t HotStart{0};
uint64_t HotEnd{0};

inline bool ignoreAddress(uint64_t Address) const {
return (Address > MaxAddress) || (Address < MinAddress);
}
Expand Down
8 changes: 0 additions & 8 deletions bolt/lib/Profile/DataAggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1316,14 +1316,6 @@ std::error_code DataAggregator::printLBRHeatMap() {
}
Heatmap HM(opts::HeatmapBlock, opts::HeatmapMinAddress,
opts::HeatmapMaxAddress, getTextSections(BC));
auto getSymbolValue = [&](const MCSymbol *Symbol) -> uint64_t {
if (Symbol)
if (ErrorOr<uint64_t> SymValue = BC->getSymbolValue(*Symbol))
return SymValue.get();
return 0;
};
HM.HotStart = getSymbolValue(BC->getHotTextStartSymbol());
HM.HotEnd = getSymbolValue(BC->getHotTextEndSymbol());

if (!NumTotalSamples) {
if (opts::BasicAggregation) {
Expand Down
15 changes: 1 addition & 14 deletions bolt/lib/Profile/Heatmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "bolt/Profile/Heatmap.h"
#include "bolt/Utils/CommandLineOpts.h"
#include "llvm/ADT/AddressRanges.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Debug.h"
Expand Down Expand Up @@ -314,9 +313,6 @@ void Heatmap::printSectionHotness(raw_ostream &OS) const {
UnmappedHotness += Frequency;
};

AddressRange HotTextRange(HotStart, HotEnd);
StringRef HotTextName = "[hot text]";

for (const std::pair<const uint64_t, uint64_t> &KV : Map) {
NumTotalCounts += KV.second;
// We map an address bucket to the first section (lowest address)
Expand All @@ -332,24 +328,15 @@ void Heatmap::printSectionHotness(raw_ostream &OS) const {
}
SectionHotness[TextSections[TextSectionIndex].Name] += KV.second;
++BucketUtilization[TextSections[TextSectionIndex].Name];
if (HotTextRange.contains(Address)) {
SectionHotness[HotTextName] += KV.second;
++BucketUtilization[HotTextName];
}
}

std::vector<SectionNameAndRange> Sections(TextSections);
// Append synthetic hot text section to TextSections
if (!HotTextRange.empty())
Sections.emplace_back(SectionNameAndRange{HotTextName, HotStart, HotEnd});

assert(NumTotalCounts > 0 &&
"total number of heatmap buckets should be greater than 0");

OS << "Section Name, Begin Address, End Address, Percentage Hotness, "
<< "Utilization Pct, Partition Score\n";
const uint64_t MappedCounts = NumTotalCounts - UnmappedHotness;
for (const auto [Name, Begin, End] : Sections) {
for (const auto [Name, Begin, End] : TextSections) {
const float Hotness = 1. * SectionHotness[Name] / NumTotalCounts;
const float MappedHotness =
MappedCounts ? 1. * SectionHotness[Name] / MappedCounts : 0;
Expand Down
5 changes: 2 additions & 3 deletions bolt/lib/Rewrite/RewriteInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,9 +968,8 @@ void RewriteInstance::discoverFileObjects() {
continue;
}

// Ignore input hot markers unless in heatmap mode
if ((SymName == "__hot_start" || SymName == "__hot_end") &&
!opts::HeatmapMode)
// Ignore input hot markers
if (SymName == "__hot_start" || SymName == "__hot_end")
continue;

FileSymRefs.emplace(SymbolAddress, Symbol);
Expand Down
6 changes: 3 additions & 3 deletions bolt/test/X86/callcont-fallthru.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# RUN: %clangxx %cxxflags %s %t.so -o %t -Wl,-q -nostdlib
# RUN: link_fdata %s %t %t.pat PREAGGT1
# RUN: link_fdata %s %t %t.pat2 PREAGGT2
# RUN-DISABLED: link_fdata %s %t %t.patplt PREAGGPLT
# RUN: link_fdata %s %t %t.patplt PREAGGPLT

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

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

.globl foo
Expand Down
4 changes: 0 additions & 4 deletions bolt/test/X86/heatmap-preagg.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ RUN: --reorder-functions=cdsort --enable-bat --dyno-stats --skip-funcs=main
RUN: llvm-bolt-heatmap %t.out -o %t2 --pa -p %p/Inputs/blarge_new_bat.preagg.txt \
RUN: 2>&1 | FileCheck --check-prefix CHECK-HEATMAP-BAT %s
RUN: FileCheck %s --check-prefix CHECK-SEC-HOT-BAT --input-file %t2-section-hotness.csv
RUN: llvm-nm -n %t.out | FileCheck %s --check-prefix=CHECK-HOT-SYMS

CHECK-HEATMAP: PERF2BOLT: read 81 aggregated LBR entries
CHECK-HEATMAP: HEATMAP: invalid traces: 1
Expand All @@ -34,6 +33,3 @@ CHECK-SEC-HOT-BAT-NEXT: .bolt.org.text, 0x4010b0, 0x401c25, 38.3385, 51.0638, 0.
CHECK-SEC-HOT-BAT-NEXT: .fini, 0x401c28, 0x401c35, 0.0000, 0.0000, 0.0000
CHECK-SEC-HOT-BAT-NEXT: .text, 0x800000, 0x8002cc, 38.7595, 91.6667, 0.3553
CHECK-SEC-HOT-BAT-NEXT: .text.cold, 0x800300, 0x800415, 0.0000, 0.0000, 0.0000
CHECK-SEC-HOT-BAT-NEXT: [hot text], 0x800000, 0x8002cc, 38.7595, 91.6667, 0.3553
CHECK-HOT-SYMS: 800000 W __hot_start
CHECK-HOT-SYMS: 8002cc W __hot_end
28 changes: 0 additions & 28 deletions clang/docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,34 +134,6 @@ if (LLVM_ENABLE_SPHINX)
gen_rst_file_from_td(DiagnosticsReference.rst -gen-diag-docs ../include/clang/Basic/Diagnostic.td "${docs_targets}")
gen_rst_file_from_td(ClangCommandLineReference.rst -gen-opt-docs ../include/clang/Driver/ClangOptionDocs.td "${docs_targets}")

# Another generated file from a different source
set(docs_tools_dir ${CMAKE_CURRENT_SOURCE_DIR}/tools)
set(aopts_rst_rel_path analyzer/user-docs/Options.rst)
set(aopts_rst "${CMAKE_CURRENT_BINARY_DIR}/${aopts_rst_rel_path}")
set(analyzeroptions_def "${CMAKE_CURRENT_SOURCE_DIR}/../include/clang/StaticAnalyzer/Core/AnalyzerOptions.def")
set(aopts_rst_in "${CMAKE_CURRENT_SOURCE_DIR}/${aopts_rst_rel_path}.in")
add_custom_command(
OUTPUT ${aopts_rst}
COMMAND ${Python3_EXECUTABLE} generate_analyzer_options_docs.py
--options-def "${analyzeroptions_def}"
--template "${aopts_rst_in}"
--out "${aopts_rst}"
WORKING_DIRECTORY ${docs_tools_dir}
VERBATIM
COMMENT "Generating ${aopts_rst}"
DEPENDS ${docs_tools_dir}/${generate_aopts_docs}
${aopts_rst_in}
copy-clang-rst-docs
)
add_custom_target(generate-analyzer-options-rst DEPENDS ${aopts_rst})
foreach(target ${docs_targets})
add_dependencies(${target} generate-analyzer-options-rst)
endforeach()

# Technically this is redundant because generate-analyzer-options-rst
# depends on the copy operation (because it wants to drop a generated file
# into a subdirectory of the copied tree), but I'm leaving it here for the
# sake of clarity.
foreach(target ${docs_targets})
add_dependencies(${target} copy-clang-rst-docs)
endforeach()
Expand Down
31 changes: 2 additions & 29 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -520,36 +520,19 @@ Improvements to Clang's diagnostics
- Several compatibility diagnostics that were incorrectly being grouped under
``-Wpre-c++20-compat`` are now part of ``-Wc++20-compat``. (#GH138775)

- Improved the ``-Wtautological-overlap-compare`` diagnostics to warn about overlapping and non-overlapping ranges involving character literals and floating-point literals.
- Improved the ``-Wtautological-overlap-compare`` diagnostics to warn about overlapping and non-overlapping ranges involving character literals and floating-point literals.
The warning message for non-overlapping cases has also been improved (#GH13473).

- Fixed a duplicate diagnostic when performing typo correction on function template
calls with explicit template arguments. (#GH139226)

- Explanatory note is printed when ``assert`` fails during evaluation of a
constant expression. Prior to this, the error inaccurately implied that assert
could not be used at all in a constant expression (#GH130458)

- A new off-by-default warning ``-Wms-bitfield-padding`` has been added to alert to cases where bit-field
packing may differ under the MS struct ABI (#GH117428).

- ``-Watomic-access`` no longer fires on unreachable code. e.g.,

.. code-block:: c

_Atomic struct S { int a; } s;
void func(void) {
if (0)
s.a = 12; // Previously diagnosed with -Watomic-access, now silenced
s.a = 12; // Still diagnosed with -Watomic-access
return;
s.a = 12; // Previously diagnosed, now silenced
}


- A new ``-Wcharacter-conversion`` warns where comparing or implicitly converting
between different Unicode character types (``char8_t``, ``char16_t``, ``char32_t``).
This warning only triggers in C++ as these types are aliases in C. (#GH138526)

Improvements to Clang's time-trace
----------------------------------
Expand Down Expand Up @@ -614,7 +597,6 @@ Bug Fixes in This Version
- Fixed a crash with an invalid member function parameter list with a default
argument which contains a pragma. (#GH113722)
- Fixed assertion failures when generating name lookup table in modules. (#GH61065, #GH134739)
- Fixed an assertion failure in constant compound literal statements. (#GH139160)

Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -727,8 +709,6 @@ Bug Fixes to C++ Support
- Fixed the handling of pack indexing types in the constraints of a member function redeclaration. (#GH138255)
- Clang now correctly parses arbitrary order of ``[[]]``, ``__attribute__`` and ``alignas`` attributes for declarations (#GH133107)
- Fixed a crash when forming an invalid function type in a dependent context. (#GH138657) (#GH115725) (#GH68852)
- Clang no longer segfaults when there is a configuration mismatch between modules and their users (http://crbug.com/400353616).
- Fix an incorrect deduction when calling an explicit object member function template through an overload set address.

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -877,11 +857,6 @@ clang-format
- Add ``OneLineFormatOffRegex`` option for turning formatting off for one line.
- Add ``SpaceAfterOperatorKeyword`` option.

clang-refactor
--------------
- Reject `0` as column or line number in 1-based command-line source locations.
Fixes crash caused by `0` input in `-selection=<file>:<line>:<column>[-<line>:<column>]`. (#GH139457)

libclang
--------
- Fixed a bug in ``clang_File_isEqual`` that sometimes led to different
Expand All @@ -900,8 +875,6 @@ libclang

Code Completion
---------------
- Reject `0` as column or line number in 1-based command-line source locations.
Fixes crash caused by `0` input in `-code-completion-at=<file>:<line>:<column>`. (#GH139457)

Static Analyzer
---------------
Expand Down
1 change: 0 additions & 1 deletion clang/docs/analyzer/user-docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Contents:

user-docs/Installation
user-docs/CommandLineUsage
user-docs/Options
user-docs/UsingWithXCode
user-docs/FilingBugs
user-docs/CrossTranslationUnit
Expand Down
2 changes: 0 additions & 2 deletions clang/docs/analyzer/user-docs/CommandLineUsage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ When compiling your application to run on the simulator, it is important that **

If you aren't certain which compiler Xcode uses to build your project, try just running ``xcodebuild`` (without **scan-build**). You should see the full path to the compiler that Xcode is using, and use that as an argument to ``--use-cc``.

.. _command-line-usage-CodeChecker:

CodeChecker
-----------

Expand Down
114 changes: 0 additions & 114 deletions clang/docs/analyzer/user-docs/Options.rst.in

This file was deleted.

Loading
Loading