Skip to content

Commit c69f388

Browse files
committed
[𝘀𝗽𝗿] changes introduced through rebase
Created using spr 1.3.4 [skip ci]
2 parents 692ec9e + 022dc6b commit c69f388

File tree

3,439 files changed

+147958
-51879
lines changed

Some content is hidden

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

3,439 files changed

+147958
-51879
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function add-dependencies() {
9191
echo "${project}"
9292
case ${project} in
9393
bolt)
94-
for p in lld llvm; do
94+
for p in clang lld llvm; do
9595
echo $p
9696
done
9797
;;

.ci/monolithic-linux.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
4848
-D LLVM_LIT_ARGS="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --timeout=1200 --time-tests" \
4949
-D LLVM_ENABLE_LLD=ON \
5050
-D CMAKE_CXX_FLAGS=-gmlt \
51-
-D BOLT_CLANG_EXE=/usr/bin/clang \
5251
-D LLVM_CCACHE_BUILD=ON \
5352
-D MLIR_ENABLE_BINDINGS_PYTHON=ON
5453

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ clang/test/AST/Interp/ @tbaederr
119119
/mlir/test/python/ @ftynse @makslevental @stellaraccident
120120
/mlir/python/ @ftynse @makslevental @stellaraccident
121121

122+
# MLIR Mem2Reg/SROA
123+
/mlir/**/Transforms/Mem2Reg.* @moxinilian
124+
/mlir/**/Transforms/SROA.* @moxinilian
125+
122126
# BOLT
123127
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci
124128

.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/**

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,17 @@ jobs:
6161
]
6262
cc: [ 'clang-19' ]
6363
cxx: [ 'clang++-19' ]
64-
clang_tidy: [ 'ON' ]
6564
include:
6665
- config: 'generic-gcc'
6766
cc: 'gcc-13'
6867
cxx: 'g++-13'
69-
clang_tidy: 'OFF'
7068
steps:
7169
- uses: actions/checkout@v4
7270
- name: ${{ matrix.config }}.${{ matrix.cxx }}
7371
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
7472
env:
7573
CC: ${{ matrix.cc }}
7674
CXX: ${{ matrix.cxx }}
77-
ENABLE_CLANG_TIDY: ${{ matrix.clang_tidy }}
7875
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
7976
if: always()
8077
with:
@@ -102,28 +99,23 @@ jobs:
10299
]
103100
cc: [ 'clang-19' ]
104101
cxx: [ 'clang++-19' ]
105-
clang_tidy: [ 'ON' ]
106102
include:
107103
- config: 'generic-gcc-cxx11'
108104
cc: 'gcc-13'
109105
cxx: 'g++-13'
110-
clang_tidy: 'OFF'
111106
- config: 'generic-cxx23'
112107
cc: 'clang-17'
113108
cxx: 'clang++-17'
114-
clang_tidy: 'OFF'
115109
- config: 'generic-cxx26'
116110
cc: 'clang-18'
117111
cxx: 'clang++-18'
118-
clang_tidy: 'ON'
119112
steps:
120113
- uses: actions/checkout@v4
121114
- name: ${{ matrix.config }}
122115
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
123116
env:
124117
CC: ${{ matrix.cc }}
125118
CXX: ${{ matrix.cxx }}
126-
ENABLE_CLANG_TIDY: ${{ matrix.clang_tidy }}
127119
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
128120
if: always() # Upload artifacts even if the build or test suite fails
129121
with:
@@ -188,7 +180,6 @@ jobs:
188180
env:
189181
CC: clang-19
190182
CXX: clang++-19
191-
ENABLE_CLANG_TIDY: "OFF"
192183
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
193184
if: always()
194185
with:

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: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,12 +1725,6 @@ void RewriteInstance::adjustFunctionBoundaries() {
17251725
if (!Function.isSymbolValidInScope(Symbol, SymbolSize))
17261726
break;
17271727

1728-
// Ignore unnamed symbols. Used, for example, by debugging info on RISC-V.
1729-
if (BC->isRISCV() && cantFail(Symbol.getName()).empty()) {
1730-
++NextSymRefI;
1731-
continue;
1732-
}
1733-
17341728
// Skip basic block labels. This happens on RISC-V with linker relaxation
17351729
// enabled because every branch needs a relocation and corresponding
17361730
// symbol. We don't want to add such symbols as entry points.
@@ -4493,6 +4487,8 @@ void RewriteInstance::updateELFSymbolTable(
44934487
// Symbols for the new symbol table.
44944488
std::vector<ELFSymTy> Symbols;
44954489

4490+
bool EmittedColdFileSymbol = false;
4491+
44964492
auto getNewSectionIndex = [&](uint32_t OldIndex) {
44974493
// For dynamic symbol table, the section index could be wrong on the input,
44984494
// and its value is ignored by the runtime if it's different from
@@ -4551,6 +4547,20 @@ void RewriteInstance::updateELFSymbolTable(
45514547
Symbols.emplace_back(ICFSymbol);
45524548
}
45534549
if (Function.isSplit()) {
4550+
// Prepend synthetic FILE symbol to prevent local cold fragments from
4551+
// colliding with existing symbols with the same name.
4552+
if (!EmittedColdFileSymbol &&
4553+
FunctionSymbol.getBinding() == ELF::STB_GLOBAL) {
4554+
ELFSymTy FileSymbol;
4555+
FileSymbol.st_shndx = ELF::SHN_ABS;
4556+
FileSymbol.st_name = AddToStrTab(getBOLTFileSymbolName());
4557+
FileSymbol.st_value = 0;
4558+
FileSymbol.st_size = 0;
4559+
FileSymbol.st_other = 0;
4560+
FileSymbol.setBindingAndType(ELF::STB_LOCAL, ELF::STT_FILE);
4561+
Symbols.emplace_back(FileSymbol);
4562+
EmittedColdFileSymbol = true;
4563+
}
45544564
for (const FunctionFragment &FF :
45554565
Function.getLayout().getSplitFragments()) {
45564566
if (FF.getAddress()) {
@@ -5432,6 +5442,17 @@ uint64_t RewriteInstance::getNewFunctionOrDataAddress(uint64_t OldAddress) {
54325442
if (BD && BD->isMoved())
54335443
return BD->getOutputAddress();
54345444

5445+
if (const BinaryFunction *BF =
5446+
BC->getBinaryFunctionContainingAddress(OldAddress)) {
5447+
if (BF->isEmitted()) {
5448+
BC->errs() << "BOLT-ERROR: unable to get new address corresponding to "
5449+
"input address 0x"
5450+
<< Twine::utohexstr(OldAddress) << " in function " << *BF
5451+
<< ". Consider adding this function to --skip-funcs=...\n";
5452+
exit(1);
5453+
}
5454+
}
5455+
54355456
return 0;
54365457
}
54375458

bolt/test/AArch64/constant_island_pie_update.s

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# RUN: llvm-objdump -j .text -d --show-all-symbols %t.relr.bolt | FileCheck %s
1919
# RUN: llvm-objdump -j .text -d %t.relr.bolt | \
2020
# RUN: FileCheck %s --check-prefix=ADDENDCHECK
21-
# RUN: llvm-readelf -rsW %t.relr.bolt | FileCheck --check-prefix=ELFCHECK %s
21+
# RUN: llvm-readelf -rsW %t.relr.bolt | FileCheck --check-prefix=RELRELFCHECK %s
2222
# RUN: llvm-readelf -SW %t.relr.bolt | FileCheck --check-prefix=RELRSZCHECK %s
2323

2424
// Check that the CI value was updated
@@ -51,6 +51,12 @@
5151
# ELFCHECK-NEXT: {{.*}} R_AARCH64_RELATIVE
5252
# ELFCHECK: {{.*}}[[#OFF]] {{.*}} $d
5353

54+
# RELRELFCHECK: $d{{$}}
55+
# RELRELFCHECK-NEXT: $d + 0x8{{$}}
56+
# RELRELFCHECK-NEXT: $d + 0x18{{$}}
57+
# RELRELFCHECK-NEXT: mytextP
58+
# RELRELFCHECK-EMPTY:
59+
5460
// Check that .relr.dyn size is 2 bytes to ensure that last 3 relocations were
5561
// encoded as a bitmap so the total section size for 3 relocations is 2 bytes.
5662
# RELRSZCHECK: .relr.dyn RELR [[#%x,ADDR:]] [[#%x,OFF:]] {{0*}}10

bolt/test/RISCV/unnamed-sym-no-entry.c renamed to bolt/test/RISCV/fake-label-no-entry.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
// RUN: %clang %cflags -g -Wl,-q -o %t %s
77

8-
/// Verify that the binary indeed contains an unnamed symbol at _start
8+
/// Verify that the binary indeed contains a fake label ".L0 " at _start.
99
// RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=CHECK-ELF
1010
// CHECK-ELF-DAG: [[#%x,START:]] {{.*}} FUNC GLOBAL DEFAULT [[#%d,SECTION:]] _start{{$}}
11-
// CHECK-ELF-DAG: [[#%x,START]] {{.*}} NOTYPE LOCAL DEFAULT [[#SECTION]] {{$}}
11+
// CHECK-ELF-DAG: [[#%x,START]] {{.*}} NOTYPE LOCAL DEFAULT [[#SECTION]] .L0 {{$}}
1212

13-
/// Verify that BOLT did not create an extra entry point for the unnamed symbol
13+
/// Verify that BOLT did not create an extra entry point for the fake label.
1414
// RUN: llvm-bolt -o %t.bolt %t --print-cfg | FileCheck %s
1515
// CHECK: Binary Function "_start" after building cfg {
1616
// CHECK: IsMultiEntry: 0

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/indirect-goto-pie.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Check that llvm-bolt fails to process PIC binaries with computed goto, as the
2+
# support is not there yet for correctly updating dynamic relocations
3+
# referencing code inside functions.
4+
5+
REQUIRES: x86_64-linux
6+
7+
RUN: %clang %S/Inputs/indirect_goto.c -o %t -fpic -pie -Wl,-q
8+
RUN: not llvm-bolt %t -o %t.bolt --relocs=1 --print-cfg --print-only=main \
9+
RUN: |& FileCheck %s
10+
11+
# Check that processing works if main() is skipped.
12+
RUN: llvm-bolt %t -o %t.bolt --relocs=1 --skip-funcs=main
13+
14+
CHECK: jmpq *%rax # UNKNOWN CONTROL FLOW
15+
16+
CHECK: BOLT-ERROR: unable to get new address

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

bolt/test/X86/shrinkwrapping-do-not-pessimize.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ end_if_1:
5353
.size _start, .-_start
5454

5555
.data
56-
rel: .quad end_if_1
56+
rel: .quad _start
5757

5858
# CHECK: BOLT-INFO: Shrink wrapping moved 0 spills inserting load/stores and 0 spills inserting push/pops

bolt/test/runtime/X86/Inputs/indirect_goto.c

Lines changed: 0 additions & 18 deletions
This file was deleted.

bolt/test/runtime/X86/indirect-goto-pie.test

Lines changed: 0 additions & 10 deletions
This file was deleted.

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ ClangDocContext::ClangDocContext(tooling::ExecutionContext *ECtx,
380380
this->SourceRoot = std::string(SourceRootDir);
381381
if (!RepositoryUrl.empty()) {
382382
this->RepositoryUrl = std::string(RepositoryUrl);
383-
if (!RepositoryUrl.empty() && RepositoryUrl.find("http://") != 0 &&
384-
RepositoryUrl.find("https://") != 0)
383+
if (!RepositoryUrl.empty() && !RepositoryUrl.starts_with("http://") &&
384+
!RepositoryUrl.starts_with("https://"))
385385
this->RepositoryUrl->insert(0, "https://");
386386
}
387387
}

clang-tools-extra/clang-tidy/ClangTidyCheck.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ void ClangTidyCheck::OptionsView::storeInt(ClangTidyOptions::OptionMap &Options,
139139
store(Options, LocalName, llvm::itostr(Value));
140140
}
141141

142+
void ClangTidyCheck::OptionsView::storeUnsigned(
143+
ClangTidyOptions::OptionMap &Options, StringRef LocalName,
144+
uint64_t Value) const {
145+
store(Options, LocalName, llvm::utostr(Value));
146+
}
147+
142148
template <>
143149
void ClangTidyCheck::OptionsView::store<bool>(
144150
ClangTidyOptions::OptionMap &Options, StringRef LocalName,

clang-tools-extra/clang-tidy/ClangTidyCheck.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,10 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
411411
std::enable_if_t<std::is_integral_v<T>>
412412
store(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
413413
T Value) const {
414-
storeInt(Options, LocalName, Value);
414+
if constexpr (std::is_signed_v<T>)
415+
storeInt(Options, LocalName, Value);
416+
else
417+
storeUnsigned(Options, LocalName, Value);
415418
}
416419

417420
/// Stores an option with the check-local name \p LocalName with
@@ -422,7 +425,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
422425
store(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
423426
std::optional<T> Value) const {
424427
if (Value)
425-
storeInt(Options, LocalName, *Value);
428+
store(Options, LocalName, *Value);
426429
else
427430
store(Options, LocalName, "none");
428431
}
@@ -470,6 +473,8 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
470473
void storeInt(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
471474
int64_t Value) const;
472475

476+
void storeUnsigned(ClangTidyOptions::OptionMap &Options,
477+
StringRef LocalName, uint64_t Value) const;
473478

474479
std::string NamePrefix;
475480
const ClangTidyOptions::OptionMap &CheckOptions;

0 commit comments

Comments
 (0)