Skip to content

Commit ab8a921

Browse files
Merge branch 'main' into verify
2 parents bb03496 + bb2b04c commit ab8a921

File tree

436 files changed

+15057
-5536
lines changed

Some content is hidden

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

436 files changed

+15057
-5536
lines changed

.github/new-prs-labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
BOLT:
2+
- bolt/**/*
3+
14
ClangIR:
25
- clang/include/clang/CIR/**/*
36
- clang/lib/CIR/**/*
@@ -467,6 +470,7 @@ backend:m68k:
467470

468471
libc++:
469472
- libcxx/**
473+
- .github/workflows/libcxx-*
470474

471475
libc++abi:
472476
- libcxxabi/**

bolt/include/bolt/Passes/BinaryPasses.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,7 @@ class PrintProfileStats : public BinaryFunctionPass {
400400
/// dyno stats categories.
401401
class PrintProgramStats : public BinaryFunctionPass {
402402
public:
403-
explicit PrintProgramStats(const cl::opt<bool> &PrintPass)
404-
: BinaryFunctionPass(PrintPass) {}
403+
explicit PrintProgramStats() : BinaryFunctionPass(false) {}
405404

406405
const char *getName() const override { return "print-stats"; }
407406
bool shouldPrint(const BinaryFunction &) const override { return false; }

bolt/include/bolt/Rewrite/RewriteInstance.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ class RewriteInstance {
426426
static StringRef getEHFrameSectionName() { return ".eh_frame"; }
427427
static StringRef getRelaDynSectionName() { return ".rela.dyn"; }
428428

429+
/// FILE symbol name used for local fragments of global functions.
430+
static StringRef getBOLTFileSymbolName() { return "bolt-pseudo.o"; }
431+
429432
/// An instance of the input binary we are processing, externally owned.
430433
llvm::object::ELFObjectFileBase *InputFile;
431434

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "bolt/Profile/DataAggregator.h"
1515
#include "bolt/Core/BinaryContext.h"
1616
#include "bolt/Core/BinaryFunction.h"
17+
#include "bolt/Passes/BinaryPasses.h"
1718
#include "bolt/Profile/BoltAddressTranslation.h"
1819
#include "bolt/Profile/Heatmap.h"
1920
#include "bolt/Profile/YAMLProfileWriter.h"
@@ -611,6 +612,7 @@ Error DataAggregator::readProfile(BinaryContext &BC) {
611612
if (std::error_code EC = writeBATYAML(BC, opts::SaveProfile))
612613
report_error("cannot create output data file", EC);
613614
}
615+
BC.logBOLTErrorsAndQuitOnFatal(PrintProgramStats().runOnFunctions(BC));
614616
}
615617

616618
return Error::success();

bolt/lib/Rewrite/BinaryPassManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
356356
// order they're registered.
357357

358358
// Run this pass first to use stats for the original functions.
359-
Manager.registerPass(std::make_unique<PrintProgramStats>(NeverPrint));
359+
Manager.registerPass(std::make_unique<PrintProgramStats>());
360360

361361
if (opts::PrintProfileStats)
362362
Manager.registerPass(std::make_unique<PrintProfileStats>(NeverPrint));

bolt/lib/Rewrite/BoltDiff.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class RewriteInstanceDiff {
292292
}
293293
}
294294
}
295-
PrintProgramStats PPS(opts::NeverPrint);
295+
PrintProgramStats PPS;
296296
outs() << "* BOLT-DIFF: Starting print program stats pass for binary 1\n";
297297
RI1.BC->logBOLTErrorsAndQuitOnFatal(PPS.runOnFunctions(*RI1.BC));
298298
outs() << "* BOLT-DIFF: Starting print program stats pass for binary 2\n";

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4493,6 +4493,8 @@ void RewriteInstance::updateELFSymbolTable(
44934493
// Symbols for the new symbol table.
44944494
std::vector<ELFSymTy> Symbols;
44954495

4496+
bool EmittedColdFileSymbol = false;
4497+
44964498
auto getNewSectionIndex = [&](uint32_t OldIndex) {
44974499
// For dynamic symbol table, the section index could be wrong on the input,
44984500
// and its value is ignored by the runtime if it's different from
@@ -4551,6 +4553,20 @@ void RewriteInstance::updateELFSymbolTable(
45514553
Symbols.emplace_back(ICFSymbol);
45524554
}
45534555
if (Function.isSplit()) {
4556+
// Prepend synthetic FILE symbol to prevent local cold fragments from
4557+
// colliding with existing symbols with the same name.
4558+
if (!EmittedColdFileSymbol &&
4559+
FunctionSymbol.getBinding() == ELF::STB_GLOBAL) {
4560+
ELFSymTy FileSymbol;
4561+
FileSymbol.st_shndx = ELF::SHN_ABS;
4562+
FileSymbol.st_name = AddToStrTab(getBOLTFileSymbolName());
4563+
FileSymbol.st_value = 0;
4564+
FileSymbol.st_size = 0;
4565+
FileSymbol.st_other = 0;
4566+
FileSymbol.setBindingAndType(ELF::STB_LOCAL, ELF::STT_FILE);
4567+
Symbols.emplace_back(FileSymbol);
4568+
EmittedColdFileSymbol = true;
4569+
}
45544570
for (const FunctionFragment &FF :
45554571
Function.getLayout().getSplitFragments()) {
45564572
if (FF.getAddress()) {

bolt/test/X86/cdsplit-symbol-names.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# RUN: --call-scale=2 --data=%t.fdata --reorder-blocks=ext-tsp
1111
# RUN: llvm-objdump --syms %t.bolt | FileCheck %s --check-prefix=CHECK-SYMS-WARM
1212

13+
# CHECK-SYMS-WARM: 0000000000000000 l df *ABS* 0000000000000000 bolt-pseudo.o
1314
# CHECK-SYMS-WARM: .text.warm
1415
# CHECK-SYMS-WARM-SAME: chain.warm
1516
# CHECK-SYMS-WARM: .text.cold

bolt/test/X86/pre-aggregated-perf.test

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ REQUIRES: system-linux
1111

1212
RUN: yaml2obj %p/Inputs/blarge.yaml &> %t.exe
1313
RUN: perf2bolt %t.exe -o %t --pa -p %p/Inputs/pre-aggregated.txt -w %t.new \
14-
RUN: --profile-use-dfs
14+
RUN: --profile-use-dfs | FileCheck %s
15+
16+
RUN: llvm-bolt %t.exe -data %t -o %t.null | FileCheck %s
17+
RUN: llvm-bolt %t.exe -data %t.new -o %t.null | FileCheck %s
18+
RUN: llvm-bolt %t.exe -p %p/Inputs/pre-aggregated.txt --pa -o %t.null | FileCheck %s
19+
20+
CHECK: BOLT-INFO: 4 out of 7 functions in the binary (57.1%) have non-empty execution profile
21+
1522
RUN: cat %t | sort | FileCheck %s -check-prefix=PERF2BOLT
1623
RUN: cat %t.new | FileCheck %s -check-prefix=NEWFORMAT
1724

clang-tools-extra/clang-tidy/modernize/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ add_clang_library(clangTidyModernizeModule
1616
MakeSharedCheck.cpp
1717
MakeSmartPtrCheck.cpp
1818
MakeUniqueCheck.cpp
19+
MinMaxUseInitializerListCheck.cpp
1920
ModernizeTidyModule.cpp
2021
PassByValueCheck.cpp
2122
RawStringLiteralCheck.cpp

0 commit comments

Comments
 (0)