Skip to content

Commit c315e7b

Browse files
committed
Resolve merge conflicts
Change-Id: Icdbaccd7e3e3665f6498341e764531d94a6a1c0d
2 parents 1df40d1 + 58035b5 commit c315e7b

File tree

1,196 files changed

+50460
-21905
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,196 files changed

+50460
-21905
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
**/crash_diagnostics/*
125125
stage3:
126126
if: github.repository_owner == 'llvm'
127-
needs: [ stage1, stage2 ]
127+
needs: [ stage2 ]
128128
continue-on-error: false
129129
strategy:
130130
fail-fast: false
@@ -188,7 +188,7 @@ jobs:
188188
**/crash_diagnostics/*
189189
190190
macos:
191-
needs: [ stage1 ]
191+
needs: [ stage3 ]
192192
strategy:
193193
fail-fast: false
194194
matrix:
@@ -232,7 +232,7 @@ jobs:
232232
233233
windows:
234234
runs-on: windows-2022
235-
needs: [ stage1 ]
235+
needs: [ stage2 ]
236236
strategy:
237237
fail-fast: false
238238
matrix:

.github/workflows/premerge.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ on:
1414
# do this is that it allows us to take advantage of concurrency groups
1515
# to cancel in progress CI jobs whenever the PR is closed.
1616
- closed
17-
paths:
18-
- .github/workflows/premerge.yaml
1917
push:
2018
branches:
2119
- 'main'
@@ -27,6 +25,7 @@ concurrency:
2725

2826
jobs:
2927
premerge-checks-linux:
28+
name: Linux Premerge Checks (Test Only - Please Ignore Results)
3029
if: >-
3130
github.repository_owner == 'llvm' &&
3231
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -85,6 +84,7 @@ jobs:
8584
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
8685
8786
premerge-checks-windows:
87+
name: Windows Premerge Checks (Test Only - Please Ignore Results)
8888
if: >-
8989
github.repository_owner == 'llvm' &&
9090
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -145,6 +145,7 @@ jobs:
145145
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
146146
147147
premerge-check-macos:
148+
name: MacOS Premerge Checks
148149
runs-on: macos-14
149150
if: >-
150151
github.repository_owner == 'llvm' &&

bolt/include/bolt/Core/Linker.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ class BOLTLinker {
4646
/// Return the address and size of a symbol or std::nullopt if it cannot be
4747
/// found.
4848
virtual std::optional<SymbolInfo> lookupSymbolInfo(StringRef Name) const = 0;
49-
50-
/// Return the address of a symbol or std::nullopt if it cannot be found.
51-
std::optional<uint64_t> lookupSymbol(StringRef Name) const {
52-
if (const auto Info = lookupSymbolInfo(Name))
53-
return Info->Address;
54-
return std::nullopt;
55-
}
5649
};
5750

5851
} // namespace bolt

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,11 @@ void BinaryFunction::print(raw_ostream &OS, std::string Annotation) {
498498
if (!IslandOffset)
499499
return;
500500

501+
// Print label if it exists at this offset.
502+
if (const BinaryData *BD =
503+
BC.getBinaryDataAtAddress(getAddress() + *IslandOffset))
504+
OS << BD->getName() << ":\n";
505+
501506
const size_t IslandSize = getSizeOfDataInCodeAt(*IslandOffset);
502507
BC.printData(OS, BC.extractData(getAddress() + *IslandOffset, IslandSize),
503508
*IslandOffset);
@@ -1066,7 +1071,7 @@ size_t BinaryFunction::getSizeOfDataInCodeAt(uint64_t Offset) const {
10661071
auto Iter = Islands->CodeOffsets.upper_bound(Offset);
10671072
if (Iter != Islands->CodeOffsets.end())
10681073
return *Iter - Offset;
1069-
return getSize() - Offset;
1074+
return getMaxSize() - Offset;
10701075
}
10711076

10721077
std::optional<uint64_t>
@@ -4254,21 +4259,21 @@ void BinaryFunction::updateOutputValues(const BOLTLinker &Linker) {
42544259

42554260
if (BC.HasRelocations || isInjected()) {
42564261
if (hasConstantIsland()) {
4257-
const auto DataAddress =
4258-
Linker.lookupSymbol(getFunctionConstantIslandLabel()->getName());
4259-
assert(DataAddress && "Cannot find function CI symbol");
4260-
setOutputDataAddress(*DataAddress);
4262+
const auto IslandLabelSymInfo =
4263+
Linker.lookupSymbolInfo(getFunctionConstantIslandLabel()->getName());
4264+
assert(IslandLabelSymInfo && "Cannot find function CI symbol");
4265+
setOutputDataAddress(IslandLabelSymInfo->Address);
42614266
for (auto It : Islands->Offsets) {
42624267
const uint64_t OldOffset = It.first;
42634268
BinaryData *BD = BC.getBinaryDataAtAddress(getAddress() + OldOffset);
42644269
if (!BD)
42654270
continue;
42664271

42674272
MCSymbol *Symbol = It.second;
4268-
const auto NewAddress = Linker.lookupSymbol(Symbol->getName());
4269-
assert(NewAddress && "Cannot find CI symbol");
4273+
const auto SymInfo = Linker.lookupSymbolInfo(Symbol->getName());
4274+
assert(SymInfo && "Cannot find CI symbol");
42704275
auto &Section = *getCodeSection();
4271-
const auto NewOffset = *NewAddress - Section.getOutputAddress();
4276+
const auto NewOffset = SymInfo->Address - Section.getOutputAddress();
42724277
BD->setOutputLocation(Section, NewOffset);
42734278
}
42744279
}
@@ -4293,10 +4298,10 @@ void BinaryFunction::updateOutputValues(const BOLTLinker &Linker) {
42934298
FF.setAddress(ColdStartSymbolInfo->Address);
42944299
FF.setImageSize(ColdStartSymbolInfo->Size);
42954300
if (hasConstantIsland()) {
4296-
const auto DataAddress = Linker.lookupSymbol(
4301+
const auto SymInfo = Linker.lookupSymbolInfo(
42974302
getFunctionColdConstantIslandLabel()->getName());
4298-
assert(DataAddress && "Cannot find cold CI symbol");
4299-
setOutputColdDataAddress(*DataAddress);
4303+
assert(SymInfo && "Cannot find cold CI symbol");
4304+
setOutputColdDataAddress(SymInfo->Address);
43004305
}
43014306
}
43024307
}

bolt/lib/Passes/Inliner.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ ForceInlineFunctions("force-inline",
4949
cl::Hidden,
5050
cl::cat(BoltOptCategory));
5151

52+
static cl::list<std::string> SkipInlineFunctions(
53+
"skip-inline", cl::CommaSeparated,
54+
cl::desc("list of functions to never consider for inlining"),
55+
cl::value_desc("func1,func2,func3,..."), cl::Hidden,
56+
cl::cat(BoltOptCategory));
57+
5258
static cl::opt<bool> InlineAll("inline-all", cl::desc("inline all functions"),
5359
cl::cat(BoltOptCategory));
5460

@@ -105,6 +111,12 @@ bool mustConsider(const llvm::bolt::BinaryFunction &Function) {
105111
return false;
106112
}
107113

114+
bool mustSkip(const llvm::bolt::BinaryFunction &Function) {
115+
return llvm::any_of(opts::SkipInlineFunctions, [&](const std::string &Name) {
116+
return Function.hasName(Name);
117+
});
118+
}
119+
108120
void syncOptions() {
109121
if (opts::InlineIgnoreCFI)
110122
opts::InlineIgnoreLeafCFI = true;
@@ -223,7 +235,7 @@ InliningInfo getInliningInfo(const BinaryFunction &BF) {
223235
void Inliner::findInliningCandidates(BinaryContext &BC) {
224236
for (const auto &BFI : BC.getBinaryFunctions()) {
225237
const BinaryFunction &Function = BFI.second;
226-
if (!shouldOptimize(Function))
238+
if (!shouldOptimize(Function) || opts::mustSkip(Function))
227239
continue;
228240
const InliningInfo InlInfo = getInliningInfo(Function);
229241
if (InlInfo.Type != INL_NONE)

bolt/lib/Rewrite/JITLinkLinker.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ struct JITLinkLinker::Context : jitlink::JITLinkContext {
125125
std::string SymName = (*Symbol.first).str();
126126
LLVM_DEBUG(dbgs() << "BOLT: looking for " << SymName << "\n");
127127

128-
if (auto Address = Linker.lookupSymbol(SymName)) {
128+
if (auto SymInfo = Linker.lookupSymbolInfo(SymName)) {
129129
LLVM_DEBUG(dbgs() << "Resolved to address 0x"
130-
<< Twine::utohexstr(*Address) << "\n");
130+
<< Twine::utohexstr(SymInfo->Address) << "\n");
131131
AllResults[Symbol.first] = orc::ExecutorSymbolDef(
132-
orc::ExecutorAddr(*Address), JITSymbolFlags());
132+
orc::ExecutorAddr(SymInfo->Address), JITSymbolFlags());
133133
continue;
134134
}
135135

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5907,9 +5907,9 @@ void RewriteInstance::writeEHFrameHeader() {
59075907
}
59085908

59095909
uint64_t RewriteInstance::getNewValueForSymbol(const StringRef Name) {
5910-
auto Value = Linker->lookupSymbol(Name);
5910+
auto Value = Linker->lookupSymbolInfo(Name);
59115911
if (Value)
5912-
return *Value;
5912+
return Value->Address;
59135913

59145914
// Return the original value if we haven't emitted the symbol.
59155915
BinaryData *BD = BC->getBinaryDataByName(Name);

bolt/lib/RuntimeLibs/HugifyRuntimeLibrary.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ void HugifyRuntimeLibrary::link(BinaryContext &BC, StringRef ToolPath,
6868

6969
assert(!RuntimeStartAddress &&
7070
"We don't currently support linking multiple runtime libraries");
71-
RuntimeStartAddress = Linker.lookupSymbol("__bolt_hugify_self").value_or(0);
72-
if (!RuntimeStartAddress) {
71+
auto StartSymInfo = Linker.lookupSymbolInfo("__bolt_hugify_self");
72+
if (!StartSymInfo) {
7373
errs() << "BOLT-ERROR: hugify library does not define __bolt_hugify_self: "
7474
<< LibPath << "\n";
7575
exit(1);
7676
}
77+
RuntimeStartAddress = StartSymInfo->Address;
7778
}

bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,27 +203,35 @@ void InstrumentationRuntimeLibrary::link(
203203
if (BC.isMachO())
204204
return;
205205

206-
RuntimeFiniAddress = Linker.lookupSymbol("__bolt_instr_fini").value_or(0);
207-
if (!RuntimeFiniAddress) {
206+
std::optional<BOLTLinker::SymbolInfo> FiniSymInfo =
207+
Linker.lookupSymbolInfo("__bolt_instr_fini");
208+
if (!FiniSymInfo) {
208209
errs() << "BOLT-ERROR: instrumentation library does not define "
209210
"__bolt_instr_fini: "
210211
<< LibPath << "\n";
211212
exit(1);
212213
}
213-
RuntimeStartAddress = Linker.lookupSymbol("__bolt_instr_start").value_or(0);
214-
if (!RuntimeStartAddress) {
214+
RuntimeFiniAddress = FiniSymInfo->Address;
215+
216+
std::optional<BOLTLinker::SymbolInfo> StartSymInfo =
217+
Linker.lookupSymbolInfo("__bolt_instr_start");
218+
if (!StartSymInfo) {
215219
errs() << "BOLT-ERROR: instrumentation library does not define "
216220
"__bolt_instr_start: "
217221
<< LibPath << "\n";
218222
exit(1);
219223
}
224+
RuntimeStartAddress = StartSymInfo->Address;
225+
220226
outs() << "BOLT-INFO: output linked against instrumentation runtime "
221227
"library, lib entry point is 0x"
222228
<< Twine::utohexstr(RuntimeStartAddress) << "\n";
229+
230+
std::optional<BOLTLinker::SymbolInfo> ClearSymInfo =
231+
Linker.lookupSymbolInfo("__bolt_instr_clear_counters");
232+
const uint64_t ClearSymAddress = ClearSymInfo ? ClearSymInfo->Address : 0;
223233
outs() << "BOLT-INFO: clear procedure is 0x"
224-
<< Twine::utohexstr(
225-
Linker.lookupSymbol("__bolt_instr_clear_counters").value_or(0))
226-
<< "\n";
234+
<< Twine::utohexstr(ClearSymAddress) << "\n";
227235

228236
emitTablesAsELFNote(BC);
229237
}

bolt/test/AArch64/data-in-code.s

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
## Check disassembly of BOLT input.
88
# RUN: llvm-objdump %t.exe -d | FileCheck %s
99

10-
# RUN: llvm-bolt %t.exe -o %t.bolt --print-disasm | FileCheck %s
10+
# RUN: llvm-bolt %t.exe -o %t.bolt --print-disasm \
11+
# RUN: | FileCheck %s --check-prefixes CHECK,CHECK-BOLT-ONLY
1112

1213
.text
1314
.balign 4
@@ -16,16 +17,21 @@
1617
.type _start, %function
1718
_start:
1819
mov x0, #0x0
20+
ldr x1, .L1
1921
.word 0x4f82e010
2022
ret
23+
.size _start, .-_start
24+
.L1:
2125
.byte 0x0, 0xff, 0x42
2226
# CHECK-LABEL: _start
2327
# CHECK: mov x0, #0x0
28+
# CHECK-NEXT: ldr x1
29+
# CHECK-BOLT-ONLY-SAME: ISLANDat[[ADDR:]]
2430
# CHECK-NEXT: .word 0x4f82e010
2531
# CHECK-NEXT: ret
32+
# CHECK-BOLT-ONLY-NEXT: ISLANDat[[ADDR]]
2633
# CHECK-NEXT: .short 0xff00
2734
# CHECK-NEXT: .byte 0x42
28-
.size _start, .-_start
2935

3036
## Force relocation mode.
3137
.reloc 0, R_AARCH64_NONE

0 commit comments

Comments
 (0)