Skip to content

Commit 5c9e43e

Browse files
committed
Merge branch 'pgo-estimated-trip-count' into fix-peel-branch-weights
2 parents 59ab013 + b8aed9b commit 5c9e43e

File tree

3,531 files changed

+247837
-100265
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,531 files changed

+247837
-100265
lines changed

.ci/all_requirements.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ ml-dtypes==0.5.1 ; python_version < "3.13" \
194194
--hash=sha256:d13755f8e8445b3870114e5b6240facaa7cb0c3361e54beba3e07fa912a6e12b \
195195
--hash=sha256:fd918d4e6a4e0c110e2e05be7a7814d10dc1b95872accbf6512b80a109b71ae1
196196
# via -r mlir/python/requirements.txt
197-
nanobind==2.7.0 \
198-
--hash=sha256:73b12d0e751d140d6c1bf4b215e18818a8debfdb374f08dc3776ad208d808e74 \
199-
--hash=sha256:f9f1b160580c50dcf37b6495a0fd5ec61dc0d95dae5f8004f87dd9ad7eb46b34
197+
nanobind==2.9.2 \
198+
--hash=sha256:c37957ffd5eac7eda349cff3622ecd32e5ee1244ecc912c99b5bc8188bafd16e \
199+
--hash=sha256:e7608472de99d375759814cab3e2c94aba3f9ec80e62cfef8ced495ca5c27d6e
200200
# via -r mlir/python/requirements.txt
201201
numpy==2.0.2 \
202202
--hash=sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a \
@@ -383,6 +383,10 @@ swig==4.3.1 \
383383
--hash=sha256:efec16327029f682f649a26da726bb0305be8800bd0f1fa3e81bf0769cf5b476 \
384384
--hash=sha256:fc496c0d600cf1bb2d91e28d3d6eae9c4301e5ea7a0dec5a4281b5efed4245a8
385385
# via -r lldb/test/requirements.txt
386+
typing-extensions==4.15.0 \
387+
--hash=sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466 \
388+
--hash=sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548
389+
# via -r mlir/python/requirements.txt
386390
urllib3==2.5.0 \
387391
--hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \
388392
--hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc

.ci/monolithic-windows.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ start-group "ninja"
5656
# Targets are not escaped as they are passed as separate arguments.
5757
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
5858

59-
start-group "ninja runtimes"
60-
61-
ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log
59+
if [[ "${runtime_targets}" != "" ]]; then
60+
start-group "ninja runtimes"
61+
62+
ninja -C "${BUILD_DIR}" -k 0 ${runtimes_targets} |& tee ninja_runtimes.log
63+
fi

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/runtimes/ @llvm/reviewers-libcxx
1818

1919
/llvm/lib/Analysis/BasicAliasAnalysis.cpp @nikic
20+
/llvm/lib/Analysis/HashRecognize.cpp @artagnon @pfusik
2021
/llvm/lib/Analysis/InstructionSimplify.cpp @nikic
2122
/llvm/lib/Analysis/LazyValueInfo.cpp @nikic
2223
/llvm/lib/Analysis/ScalarEvolution.cpp @nikic

bolt/lib/Core/BinaryContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,15 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
207207
Twine("BOLT-ERROR: ", Error));
208208

209209
std::unique_ptr<const MCRegisterInfo> MRI(
210-
TheTarget->createMCRegInfo(TripleName));
210+
TheTarget->createMCRegInfo(TheTriple));
211211
if (!MRI)
212212
return createStringError(
213213
make_error_code(std::errc::not_supported),
214214
Twine("BOLT-ERROR: no register info for target ", TripleName));
215215

216216
// Set up disassembler.
217217
std::unique_ptr<MCAsmInfo> AsmInfo(
218-
TheTarget->createMCAsmInfo(*MRI, TripleName, MCTargetOptions()));
218+
TheTarget->createMCAsmInfo(*MRI, TheTriple, MCTargetOptions()));
219219
if (!AsmInfo)
220220
return createStringError(
221221
make_error_code(std::errc::not_supported),
@@ -227,7 +227,7 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext(
227227
AsmInfo->setAllowAtInName(true);
228228

229229
std::unique_ptr<const MCSubtargetInfo> STI(
230-
TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
230+
TheTarget->createMCSubtargetInfo(TheTriple, "", FeaturesStr));
231231
if (!STI)
232232
return createStringError(
233233
make_error_code(std::errc::not_supported),

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,10 +2517,8 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
25172517
createInstrIncMemory(const MCSymbol *Target, MCContext *Ctx, bool IsLeaf,
25182518
unsigned CodePointerSize) const override {
25192519
unsigned int I = 0;
2520-
InstructionListType Instrs(IsLeaf ? 12 : 10);
2520+
InstructionListType Instrs(10);
25212521

2522-
if (IsLeaf)
2523-
createStackPointerIncrement(Instrs[I++], 128);
25242522
createPushRegisters(Instrs[I++], AArch64::X0, AArch64::X1);
25252523
getSystemFlag(Instrs[I++], AArch64::X1);
25262524
InstructionListType Addr = materializeAddress(Target, Ctx, AArch64::X0);
@@ -2535,8 +2533,6 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
25352533
loadReg(Instrs[I++], AArch64::X2, AArch64::SP);
25362534
setSystemFlag(Instrs[I++], AArch64::X1);
25372535
createPopRegisters(Instrs[I++], AArch64::X0, AArch64::X1);
2538-
if (IsLeaf)
2539-
createStackPointerDecrement(Instrs[I++], 128);
25402536
return Instrs;
25412537
}
25422538

bolt/runtime/instr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,11 @@ static char *getBinaryPath() {
714714
uint32_t Ret = __readlink(FindBuf, TargetPath, sizeof(TargetPath));
715715
assert(Ret != -1 && Ret != BufSize, "readlink error");
716716
TargetPath[Ret] = '\0';
717+
__close(FDdir);
717718
return TargetPath;
718719
}
719720
}
721+
__close(FDdir);
720722
return nullptr;
721723
}
722724

bolt/test/link_fdata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
# Regexes to extract FDATA lines from input and parse FDATA and pre-aggregated
3434
# profile data
35-
prefix_pat = re.compile(f"^# {args.prefix}: (.*)")
35+
prefix_pat = re.compile(f"^(#|//) {args.prefix}: (.*)")
3636

3737
# FDATA records:
3838
# <is symbol?> <closest elf symbol or DSO name> <relative FROM address>
@@ -61,7 +61,7 @@
6161
prefix_match = prefix_pat.match(line)
6262
if not prefix_match:
6363
continue
64-
profile_line = prefix_match.group(1)
64+
profile_line = prefix_match.group(2)
6565
fdata_match = fdata_pat.match(profile_line)
6666
preagg_match = preagg_pat.match(profile_line)
6767
nolbr_match = nolbr_pat.match(profile_line)

bolt/test/runtime/copy_file.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
import shutil
3+
4+
with open(sys.argv[1] + ".output") as log_file:
5+
lines = log_file.readlines()
6+
for line in lines:
7+
if line.startswith(sys.argv[2]):
8+
pid = line.split(" ")[1].strip()
9+
shutil.copy(
10+
sys.argv[1] + "." + pid + ".fdata",
11+
sys.argv[1] + "." + sys.argv[3] + ".fdata",
12+
)
13+
sys.exit(0)
14+
15+
sys.exit(1)

bolt/test/runtime/instrumentation-indirect-2.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int main() {
5050
return 0;
5151
}
5252
/*
53-
REQUIRES: system-linux,shell,fuser
53+
REQUIRES: system-linux,fuser
5454
5555
RUN: %clang %cflags %s -o %t.exe -Wl,-q -pie -fpie
5656
@@ -61,10 +61,14 @@ RUN: --instrumentation-wait-forks
6161
6262
# Instrumented program needs to finish returning zero
6363
# Both output and profile must contain all 16 functions
64-
RUN: %t.instrumented_conservative > %t.output
65-
# Wait for profile and output to be fully written
66-
RUN: bash %S/wait_file.sh %t.output
67-
RUN: bash %S/wait_file.sh %t.fdata
64+
# We need to use bash to invoke this as otherwise we hang inside a
65+
# popen.communicate call in lit's internal shell. Eventually we should not
66+
# need this.
67+
# TODO(boomanaiden154): Remove once
68+
# https://github.com/llvm/llvm-project/issues/156484 is fixed.
69+
RUN: bash -c "%t.instrumented_conservative; wait" > %t.output
70+
# We can just read because we ensure the profile will be fully written by
71+
# calling wait inside the bash invocation.
6872
RUN: cat %t.output | FileCheck %s --check-prefix=CHECK-OUTPUT
6973
RUN: cat %t.fdata | FileCheck %s --check-prefix=CHECK-COMMON-PROF
7074
@@ -112,14 +116,8 @@ RUN: bash %S/wait_file.sh %t.output
112116
# Make sure all functions were called
113117
RUN: cat %t.output | FileCheck %s --check-prefix=CHECK-OUTPUT
114118
115-
RUN: child_pid=$(cat %t.output | grep funcA | awk '{print $2;}')
116-
RUN: par_pid=$(cat %t.output | grep funcB | awk '{print $2;}')
117-
118-
RUN: bash %S/wait_file.sh %t.$child_pid.fdata
119-
RUN: bash %S/wait_file.sh %t.$par_pid.fdata
120-
121-
RUN: mv %t.$child_pid.fdata %t.child.fdata
122-
RUN: mv %t.$par_pid.fdata %t.parent.fdata
119+
RUN: %python %S/copy_file.py %t funcA child
120+
RUN: %python %S/copy_file.py %t funcB parent
123121
124122
# Instrumented binary must produce two profiles with only local calls
125123
# recorded. Functions called only in child should not appear in parent's

bolt/test/timers.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
/* This test checks timers for metadata manager phases.
2-
# RUN: %clang %cflags %s -o %t.exe
3-
# RUN: link_fdata %s %t.exe %t.fdata
4-
# RUN: llvm-bolt %t.exe -o %t.null --data %t.fdata -w %t.yaml --time-rewrite \
5-
# RUN: 2>&1 | FileCheck %s
6-
# RUN: link_fdata %s %t.exe %t.preagg PREAGG
7-
# RUN: perf2bolt %t.exe -o %t.null -p %t.preagg --pa --time-rewrite \
8-
# RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-P2B
1+
// This test checks timers for metadata manager phases.
2+
// RUN: %clang %cflags %s -o %t.exe
3+
// RUN: link_fdata %s %t.exe %t.fdata
4+
// RUN: llvm-bolt %t.exe -o %t.null --data %t.fdata -w %t.yaml --time-rewrite \
5+
// RUN: 2>&1 | FileCheck %s
6+
// RUN: link_fdata %s %t.exe %t.preagg PREAGG
7+
// RUN: perf2bolt %t.exe -o %t.null -p %t.preagg --pa --time-rewrite \
8+
// RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-P2B
99

10-
# CHECK-DAG: update metadata post-emit
11-
# CHECK-DAG: process section metadata
12-
# CHECK-DAG: process metadata pre-CFG
13-
# CHECK-DAG: process metadata post-CFG
14-
# CHECK-DAG: finalize metadata pre-emit
10+
// CHECK-DAG: update metadata post-emit
11+
// CHECK-DAG: process section metadata
12+
// CHECK-DAG: process metadata pre-CFG
13+
// CHECK-DAG: process metadata post-CFG
14+
// CHECK-DAG: finalize metadata pre-emit
1515

16-
# CHECK-P2B-DAG: process section metadata
17-
# CHECK-P2B-DAG: process metadata pre-CFG
16+
// CHECK-P2B-DAG: process section metadata
17+
// CHECK-P2B-DAG: process metadata pre-CFG
1818

19-
# FDATA: 0 [unknown] 0 1 main 0 1 0
20-
# PREAGG: B X:0 #main# 1 0
21-
*/
19+
// FDATA: 0 [unknown] 0 1 main 0 1 0
20+
// PREAGG: B X:0 #main# 1 0
2221
int main() { return 0; }

0 commit comments

Comments
 (0)