Skip to content

Commit 6d47e3f

Browse files
committed
Merge branch 'main' into scf_for_bug
2 parents 3bdb596 + 6efd24c commit 6d47e3f

File tree

4,178 files changed

+140935
-97644
lines changed

Some content is hidden

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

4,178 files changed

+140935
-97644
lines changed

.ci/compute_projects_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_flang(self):
147147

148148
def test_invalid_subproject(self):
149149
env_variables = compute_projects.get_env_variables(
150-
[".ci/compute_projects.py"], "Linux"
150+
["third-party/benchmark/CMakeLists.txt"], "Linux"
151151
)
152152
self.assertEqual(env_variables["projects_to_build"], "")
153153
self.assertEqual(env_variables["project_check_targets"], "")
@@ -163,7 +163,7 @@ def test_top_level_file(self):
163163

164164
def test_exclude_runtiems_in_projects(self):
165165
env_variables = compute_projects.get_env_variables(
166-
[".ci/compute_projects.py", "libcxx/CMakeLists.txt"], "Linux"
166+
["libcxx/CMakeLists.txt"], "Linux"
167167
)
168168
self.assertEqual(env_variables["projects_to_build"], "")
169169
self.assertEqual(env_variables["project_check_targets"], "")
@@ -192,10 +192,10 @@ def test_ci(self):
192192
env_variables = compute_projects.get_env_variables(
193193
[".ci/compute_projects.py"], "Linux"
194194
)
195-
self.assertEqual(env_variables["projects_to_build"], "clang;lld;llvm;lldb")
195+
self.assertEqual(env_variables["projects_to_build"], "clang;lld;lldb;llvm")
196196
self.assertEqual(
197197
env_variables["project_check_targets"],
198-
"check-clang check-lld check-llvm check-lldb",
198+
"check-clang check-lld check-lldb check-llvm",
199199
)
200200
self.assertEqual(
201201
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"

.ci/metrics/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
# name.
3030
GITHUB_JOB_TO_TRACK = {
3131
"github_llvm_premerge_checks": {
32-
"Build and Test Linux (Test Only - Please Ignore Results)": "premerge_linux",
33-
"Build and Test Windows (Test Only - Please Ignore Results)": "premerge_windows",
32+
"Build and Test Linux": "premerge_linux",
33+
"Build and Test Windows": "premerge_windows",
3434
}
3535
}
3636

.github/new-prs-labeler.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,12 +703,19 @@ mlgo:
703703
- llvm/test/CodeGen/MLRegAlloc/**
704704
- llvm/utils/mlgo-utils/**
705705
- llvm/docs/MLGO.rst
706+
- llvm/include/llvm/Analysis/IR2Vec.h
707+
- llvm/lib/Analysis/IR2Vec.cpp
708+
- llvm/lib/Analysis/models/**
709+
- llvm/test/Analysis/IR2Vec/**
706710

707711
tools:llvm-exegesis:
708712
- llvm/tools/llvm-exegesis/**
709713
- llvm/test/tools/llvm-exegesis/**
710714
- llvm/unittests/tools/llvm-exegesis/**
711715

716+
tools:llvm-reduce:
717+
- llvm/tools/llvm-reduce/**
718+
712719
platform:windows:
713720
- lld/COFF/**
714721
- clang/lib/Driver/MSVC.cpp

.github/workflows/containers/github-action-ci-windows/Dockerfile

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,15 @@ RUN regsvr32 /S "C:\BuildTools\DIA SDK\bin\amd64\msdia140.dll" & \
3939

4040
# install tools as described in https://llvm.org/docs/GettingStartedVS.html
4141
# and a few more that were not documented...
42-
RUN choco install -y ninja git
42+
RUN choco install -y ninja git sccache
4343
# Pin an older version of Python; the current Python 3.10 fails when
4444
# doing "pip install" for the other dependencies, as it fails to find libxml
4545
# while compiling some package.
4646
RUN choco install -y python3 --version 3.9.7
4747

48-
# ActivePerl is currently not installable via Chocolatey, see
49-
# http://disq.us/p/2ipditb. Install StrawberryPerl instead. Unfortunately,
50-
# StrawberryPerl not only installs Perl, but also a redundant C/C++ compiler
51-
# toolchain, and a copy of pkg-config which can cause misdetections for other
52-
# built products, see
53-
# https://github.com/StrawberryPerl/Perl-Dist-Strawberry/issues/11 for further
54-
# details. Remove the redundant and unnecessary parts of the StrawberryPerl
55-
# install.
56-
RUN choco install -y strawberryperl && \
57-
rmdir /q /s c:\strawberry\c && \
58-
del /q c:\strawberry\perl\bin\pkg-config*
59-
60-
# libcxx requires clang(-cl) to be available
61-
RUN choco install -y sccache llvm
48+
# Testing requires psutil
6249
RUN pip install psutil
6350

64-
RUN curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-x86_64.zip && \
65-
powershell Expand-Archive llvm-mingw-*-ucrt-x86_64.zip -DestinationPath . && \
66-
del llvm-mingw-*-ucrt-x86_64.zip && \
67-
ren llvm-mingw-20230320-ucrt-x86_64 llvm-mingw
68-
6951
# configure Python encoding
7052
ENV PYTHONIOENCODING=UTF-8
7153

@@ -103,11 +85,6 @@ RUN powershell -Command \
10385
RUN git config --system core.longpaths true & \
10486
git config --global core.autocrlf false
10587
106-
# handle for debugging of files beeing locked by some processes.
107-
RUN choco install -y handle
108-
109-
RUN pip3 install pywin32 buildbot-worker==2.8.4
110-
11188
ARG RUNNER_VERSION=2.324.0
11289
ENV RUNNER_VERSION=$RUNNER_VERSION
11390

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
stage1:
3838
if: github.repository_owner == 'llvm'
3939
runs-on: libcxx-self-hosted-linux
40-
container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254
40+
container: ghcr.io/llvm/libcxx-linux-builder:b060022103f551d8ca1dad84122ef73927c86512
4141
continue-on-error: false
4242
strategy:
4343
fail-fast: false

.github/workflows/pr-code-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Install clang-format
5656
uses: aminya/setup-cpp@17c11551771948abc5752bbf3183482567c7caf0 # v1.1.1
5757
with:
58-
clangformat: 19.1.6
58+
clangformat: 20.1.5
5959

6060
- name: Setup Python env
6161
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0

.github/workflows/premerge.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ on:
1616
- closed
1717
push:
1818
branches:
19-
- 'main'
2019
- 'release/**'
2120

2221
concurrency:
@@ -25,7 +24,7 @@ concurrency:
2524

2625
jobs:
2726
premerge-checks-linux:
28-
name: Build and Test Linux (Test Only - Please Ignore Results)
27+
name: Build and Test Linux
2928
if: >-
3029
github.repository_owner == 'llvm' &&
3130
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -43,9 +42,6 @@ jobs:
4342
# Mark the job as a success even if the step fails so that people do
4443
# not get notified while the new premerge pipeline is in an
4544
# experimental state.
46-
# TODO(boomanaiden154): Remove this once the pipeline is stable and we
47-
# are ready for people to start recieving notifications.
48-
continue-on-error: true
4945
run: |
5046
git config --global --add safe.directory '*'
5147
@@ -74,7 +70,7 @@ jobs:
7470
include-hidden-files: 'true'
7571

7672
premerge-checks-windows:
77-
name: Build and Test Windows (Test Only - Please Ignore Results)
73+
name: Build and Test Windows
7874
if: >-
7975
github.repository_owner == 'llvm' &&
8076
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -110,9 +106,6 @@ jobs:
110106
# Mark the job as a success even if the step fails so that people do
111107
# not get notified while the new premerge pipeline is in an
112108
# experimental state.
113-
# TODO(boomanaiden154): Remove this once the pipeline is stable and we
114-
# are ready for people to start recieving notifications.
115-
continue-on-error: true
116109
if: ${{ steps.vars.outputs.windows-projects != '' }}
117110
shell: cmd
118111
run: |

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -562,35 +562,56 @@ class MCPlusBuilder {
562562
return {};
563563
}
564564

565-
virtual ErrorOr<MCPhysReg> getAuthenticatedReg(const MCInst &Inst) const {
566-
llvm_unreachable("not implemented");
567-
return getNoRegister();
568-
}
569-
570-
virtual bool isAuthenticationOfReg(const MCInst &Inst,
571-
MCPhysReg AuthenticatedReg) const {
565+
/// Returns the register where an authenticated pointer is written to by Inst,
566+
/// or std::nullopt if not authenticating any register.
567+
///
568+
/// Sets IsChecked if the instruction always checks authenticated pointer,
569+
/// i.e. it either writes a successfully authenticated pointer or terminates
570+
/// the program abnormally (such as "ldra x0, [x1]!" on AArch64, which crashes
571+
/// on authentication failure even if FEAT_FPAC is not implemented).
572+
virtual std::optional<MCPhysReg>
573+
getWrittenAuthenticatedReg(const MCInst &Inst, bool &IsChecked) const {
572574
llvm_unreachable("not implemented");
573-
return false;
575+
return std::nullopt;
574576
}
575577

576-
virtual MCPhysReg getSignedReg(const MCInst &Inst) const {
578+
/// Returns the register signed by Inst, or std::nullopt if not signing any
579+
/// register.
580+
///
581+
/// The returned register is assumed to be both input and output operand,
582+
/// as it is done on AArch64.
583+
virtual std::optional<MCPhysReg> getSignedReg(const MCInst &Inst) const {
577584
llvm_unreachable("not implemented");
578-
return getNoRegister();
585+
return std::nullopt;
579586
}
580587

581-
virtual ErrorOr<MCPhysReg> getRegUsedAsRetDest(const MCInst &Inst) const {
588+
/// Returns the register used as a return address. Returns std::nullopt if
589+
/// not applicable, such as reading the return address from a system register
590+
/// or from the stack.
591+
///
592+
/// Sets IsAuthenticatedInternally if the instruction accepts a signed
593+
/// pointer as its operand and authenticates it internally.
594+
///
595+
/// Should only be called when isReturn(Inst) is true.
596+
virtual std::optional<MCPhysReg>
597+
getRegUsedAsRetDest(const MCInst &Inst,
598+
bool &IsAuthenticatedInternally) const {
582599
llvm_unreachable("not implemented");
583-
return getNoRegister();
600+
return std::nullopt;
584601
}
585602

586603
/// Returns the register used as the destination of an indirect branch or call
587604
/// instruction. Sets IsAuthenticatedInternally if the instruction accepts
588605
/// a signed pointer as its operand and authenticates it internally.
606+
///
607+
/// Should only be called if isIndirectCall(Inst) or isIndirectBranch(Inst)
608+
/// returns true.
589609
virtual MCPhysReg
590610
getRegUsedAsIndirectBranchDest(const MCInst &Inst,
591611
bool &IsAuthenticatedInternally) const {
592612
llvm_unreachable("not implemented");
593-
return getNoRegister();
613+
return 0; // Unreachable. A valid register should be returned by the
614+
// target implementation.
594615
}
595616

596617
/// Returns the register containing an address safely materialized by `Inst`
@@ -602,14 +623,14 @@ class MCPlusBuilder {
602623
/// controlled, under the Pointer Authentication threat model.
603624
///
604625
/// If the instruction does not write to any register satisfying the above
605-
/// two conditions, NoRegister is returned.
626+
/// two conditions, std::nullopt is returned.
606627
///
607628
/// The Pointer Authentication threat model assumes an attacker is able to
608629
/// modify any writable memory, but not executable code (due to W^X).
609-
virtual MCPhysReg
630+
virtual std::optional<MCPhysReg>
610631
getMaterializedAddressRegForPtrAuth(const MCInst &Inst) const {
611632
llvm_unreachable("not implemented");
612-
return getNoRegister();
633+
return std::nullopt;
613634
}
614635

615636
/// Analyzes if this instruction can safely perform address arithmetics
@@ -622,10 +643,13 @@ class MCPlusBuilder {
622643
/// controlled, provided InReg and executable code are not. Please note that
623644
/// registers other than InReg as well as the contents of memory which is
624645
/// writable by the process should be considered attacker-controlled.
646+
///
647+
/// The instruction should not write any values derived from InReg anywhere,
648+
/// except for OutReg.
625649
virtual std::optional<std::pair<MCPhysReg, MCPhysReg>>
626650
analyzeAddressArithmeticsForPtrAuth(const MCInst &Inst) const {
627651
llvm_unreachable("not implemented");
628-
return std::make_pair(getNoRegister(), getNoRegister());
652+
return std::nullopt;
629653
}
630654

631655
/// Analyzes if a pointer is checked to be authenticated successfully
@@ -670,10 +694,10 @@ class MCPlusBuilder {
670694
///
671695
/// Use this function for simple, single-instruction patterns instead of
672696
/// its getAuthCheckedReg(BB) counterpart.
673-
virtual MCPhysReg getAuthCheckedReg(const MCInst &Inst,
674-
bool MayOverwrite) const {
697+
virtual std::optional<MCPhysReg> getAuthCheckedReg(const MCInst &Inst,
698+
bool MayOverwrite) const {
675699
llvm_unreachable("not implemented");
676-
return getNoRegister();
700+
return std::nullopt;
677701
}
678702

679703
virtual bool isTerminator(const MCInst &Inst) const;

bolt/lib/Core/BinaryContext.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,6 +2425,10 @@ BinaryContext::createInstructionPatch(uint64_t Address,
24252425

24262426
std::pair<size_t, size_t>
24272427
BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) {
2428+
// Use the original size for non-simple functions.
2429+
if (!BF.isSimple() || BF.isIgnored())
2430+
return std::make_pair(BF.getSize(), 0);
2431+
24282432
// Adjust branch instruction to match the current layout.
24292433
if (FixBranches)
24302434
BF.fixBranches();

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3579,6 +3579,8 @@ bool BinaryFunction::validateCFG() const {
35793579
}
35803580

35813581
void BinaryFunction::fixBranches() {
3582+
assert(isSimple() && "Expected function with valid CFG.");
3583+
35823584
auto &MIB = BC.MIB;
35833585
MCContext *Ctx = BC.Ctx.get();
35843586

bolt/lib/Core/DIEBuilder.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ void DIEBuilder::updateReferences() {
175175
LocExpr.Die.replaceValue(getState().DIEAlloc, LocExpr.Attr, LocExpr.Form,
176176
Value);
177177
}
178-
179-
return;
180178
}
181179

182180
uint32_t DIEBuilder::allocDIE(const DWARFUnit &DU, const DWARFDie &DDie,

0 commit comments

Comments
 (0)