Skip to content

Commit 31951fe

Browse files
committed
make the condition more aggressive
Created using spr 1.3.5-bogner
2 parents 4184be9 + 53edb1a commit 31951fe

File tree

860 files changed

+55481
-22236
lines changed

Some content is hidden

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

860 files changed

+55481
-22236
lines changed

.ci/generate_test_report_lib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def plural(num_tests):
9292
]
9393
)
9494
elif failures:
95-
report.extend(["", "## Failed Tests", "(click on a test name to see its output)"])
95+
report.extend(
96+
["", "## Failed Tests", "(click on a test name to see its output)"]
97+
)
9698

9799
for testsuite_name, failures in failures.items():
98100
report.extend(["", f"### {testsuite_name}"])

.ci/metrics/metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
# remain small.
6868
BUILDKITE_GRAPHQL_BUILDS_PER_PAGE = 50
6969

70+
7071
@dataclass
7172
class JobMetrics:
7273
job_name: str
@@ -77,6 +78,7 @@ class JobMetrics:
7778
workflow_id: int
7879
workflow_name: str
7980

81+
8082
@dataclass
8183
class GaugeMetric:
8284
name: str
@@ -258,6 +260,7 @@ def buildkite_get_metrics(
258260

259261
return output, incomplete_now
260262

263+
261264
def github_get_metrics(
262265
github_repo: github.Repository, last_workflows_seen_as_completed: set[int]
263266
) -> tuple[list[JobMetrics], int]:

bolt/lib/Core/BinaryContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
201201

202202
std::string Error;
203203
const Target *TheTarget =
204-
TargetRegistry::lookupTarget(std::string(ArchName), TheTriple, Error);
204+
TargetRegistry::lookupTarget(ArchName, TheTriple, Error);
205205
if (!TheTarget)
206206
return createStringError(make_error_code(std::errc::not_supported),
207207
Twine("BOLT-ERROR: ", Error));

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,7 @@ bool shouldPrint(const BinaryFunction &Function) {
166166
}
167167

168168
std::optional<StringRef> Origin = Function.getOriginSectionName();
169-
if (Origin && llvm::any_of(opts::PrintOnly, [&](const std::string &Name) {
170-
return Name == *Origin;
171-
}))
172-
return true;
173-
174-
return false;
169+
return Origin && llvm::is_contained(opts::PrintOnly, *Origin);
175170
}
176171

177172
} // namespace opts
@@ -1783,10 +1778,22 @@ bool BinaryFunction::scanExternalRefs() {
17831778
// On AArch64, we use instruction patches for fixing references. We make an
17841779
// exception for branch instructions since they require optional
17851780
// relocations.
1786-
if (BC.isAArch64() && !BranchTargetSymbol) {
1787-
LLVM_DEBUG(BC.printInstruction(dbgs(), Instruction, AbsoluteInstrAddr));
1788-
InstructionPatches.push_back({AbsoluteInstrAddr, Instruction});
1789-
continue;
1781+
if (BC.isAArch64()) {
1782+
if (!BranchTargetSymbol) {
1783+
LLVM_DEBUG(BC.printInstruction(dbgs(), Instruction, AbsoluteInstrAddr));
1784+
InstructionPatches.push_back({AbsoluteInstrAddr, Instruction});
1785+
continue;
1786+
}
1787+
1788+
// Conditional tail calls require new relocation types that are currently
1789+
// not supported. https://github.com/llvm/llvm-project/issues/138264
1790+
if (BC.MIB->isConditionalBranch(Instruction)) {
1791+
if (BinaryFunction *TargetBF =
1792+
BC.getFunctionForSymbol(BranchTargetSymbol)) {
1793+
TargetBF->setNeedsPatch(true);
1794+
continue;
1795+
}
1796+
}
17901797
}
17911798

17921799
// Emit the instruction using temp emitter and generate relocations.

bolt/test/AArch64/check-init-not-moved.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# address. Test checks that _init is not moved.
66

77
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
8-
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static -Wl,--section-start=.data=0x1000 -Wl,--section-start=.init=0x1004
8+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -static -Wl,--image-base=0,-Tdata=0x1000,--section-start=.init=0x1004
99
# RUN: llvm-bolt %t.exe -o %t.bolt
1010
# RUN: llvm-nm %t.exe | FileCheck --check-prefix=CHECK-ORIGINAL %s
1111
# RUN: llvm-nm %t.bolt | FileCheck --check-prefix=CHECK-BOLTED %s

bolt/test/AArch64/lite-mode.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ cold_function:
129129
# CHECK-INPUT-NEXT: b {{.*}} <_start>
130130
# CHECK-NEXT: b {{.*}} <_start.org.0>
131131

132+
## Quick test for conditional tail calls. A proper test is being added in:
133+
## https://github.com/llvm/llvm-project/pull/139565
134+
## For now check that llvm-bolt doesn't choke on CTCs.
135+
.ifndef COMPACT
136+
b.eq _start
137+
cbz x0, _start
138+
tbz x0, 42, _start
139+
.endif
140+
132141
.cfi_endproc
133142
.size cold_function, .-cold_function
134143

bolt/test/AArch64/pad-before-funcs.s

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

99

1010
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
11-
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -Wl,--section-start=.text=0x4000
11+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -Wl,--image-base=0x3000,--section-start=.text=0x4000
1212
# RUN: llvm-bolt %t.exe -o %t.bolt.0 --pad-funcs-before=_start:0
1313
# RUN: llvm-bolt %t.exe -o %t.bolt.4 --pad-funcs-before=_start:4
1414
# RUN: llvm-bolt %t.exe -o %t.bolt.8 --pad-funcs-before=_start:8

bolt/test/RISCV/reloc-jt.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// NOTE: assign section addresses explicitly to make the symbol difference
22
/// calculation below less fragile.
3-
// RUN: %clang %cflags -Wl,--section-start=.text=0x1000,--section-start=.data=0x2000 -o %t %s
3+
// RUN: %clang %cflags -Wl,--image-base=0,--section-start=.text=0x1000,--section-start=.data=0x2000 -o %t %s
44
// RUN: llvm-bolt -o %t.bolt %t
55
// RUN: llvm-readelf -x .data %t.bolt | FileCheck %s
66

bolt/test/X86/double-rel-scan.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# REQUIRES: system-linux
77

88
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
9-
# RUN: ld.lld %t.o -o %t.exe -q --Ttext=0x80000
9+
# RUN: ld.lld %t.o -o %t.exe -q --image-base=0x80000 --Ttext=0x80000
1010
# RUN: llvm-bolt %t.exe --relocs -o %t.bolt --funcs=foo
1111
# RUN: llvm-objdump -d --print-imm-hex %t.exe \
1212
# RUN: | FileCheck %s

bolt/test/X86/double-rel.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# REQUIRES: system-linux
66

77
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
8-
# RUN: ld.lld %t.o -o %t.exe -q --Tdata=0x80000
8+
# RUN: ld.lld %t.o -o %t.exe -q --image-base=0x70000 --Tdata=0x80000
99
# RUN: llvm-bolt %t.exe --relocs -o %t.null --print-only=_start --print-disasm \
1010
# RUN: | FileCheck %s --check-prefix=CHECK-BOLT
1111
# RUN: llvm-objdump -d --print-imm-hex %t.exe \

0 commit comments

Comments
 (0)