Skip to content

Commit 6ac5db0

Browse files
committed
Merge branch 'main' of https://github.com/llvm/llvm-project into hipstdpar_passes_reorder
2 parents 2765739 + 46135ad commit 6ac5db0

File tree

2,960 files changed

+298172
-154184
lines changed

Some content is hidden

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

2,960 files changed

+298172
-154184
lines changed

.ci/generate_test_report_lib.py

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

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

.ci/generate_test_report_lib_test.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
# To run these tests:
6+
# python -m unittest generate_test_report_lib_test.py
7+
58
import unittest
69
from io import StringIO
710
from textwrap import dedent
@@ -150,7 +153,7 @@ def test_report_single_file_single_testsuite(self):
150153
* 2 tests failed
151154
152155
## Failed Tests
153-
(click to see output)
156+
(click on a test name to see its output)
154157
155158
### Bar
156159
<details>
@@ -182,7 +185,7 @@ def test_report_single_file_single_testsuite(self):
182185
* 2 tests failed
183186
184187
## Failed Tests
185-
(click to see output)
188+
(click on a test name to see its output)
186189
187190
### ABC
188191
<details>

.ci/metrics/metrics.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ def github_get_metrics(
282282
queued_count = collections.Counter()
283283
running_count = collections.Counter()
284284

285+
# Initialize all the counters to 0 so we report 0 when no job is queued
286+
# or running.
287+
for wf_name, wf_metric_name in GITHUB_WORKFLOW_TO_TRACK.items():
288+
for job_name, job_metric_name in GITHUB_JOB_TO_TRACK[wf_metric_name].items():
289+
queued_count[wf_metric_name + "_" + job_metric_name] = 0
290+
running_count[wf_metric_name + "_" + job_metric_name] = 0
291+
285292
# The list of workflows this iteration will process.
286293
# MaxSize = GITHUB_WORKFLOWS_MAX_PROCESS_COUNT
287294
workflow_seen_as_completed = set()

.github/workflows/ci-post-commit-analyzer.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
if: >-
3535
github.repository_owner == 'llvm' &&
3636
github.event.action != 'closed'
37-
runs-on: ubuntu-22.04
37+
runs-on: ubuntu-24.04
3838
container:
39-
image: 'ghcr.io/llvm/ci-ubuntu-22.04:latest'
39+
image: 'ghcr.io/llvm/ci-ubuntu-24.04:latest'
4040
env:
4141
LLVM_VERSION: 18
4242
steps:

.github/workflows/libclang-python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ jobs:
3737
projects: clang
3838
# There is an issue running on "windows-2019".
3939
# See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082.
40-
os_list: '["ubuntu-22.04"]'
40+
os_list: '["ubuntu-24.04"]'
4141
python_version: ${{ matrix.python-version }}

.github/workflows/llvm-project-tests.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ on:
3939
type: string
4040
# Use windows-2019 due to:
4141
# https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
42-
# Use ubuntu-22.04 rather than ubuntu-24.04 to match the ubuntu
43-
# version in the CI container. Without this, setup-python tries
44-
# to install a python version linked against a newer version of glibc.
45-
# TODO(boomanaiden154): Bump the Ubuntu version once the version in the
46-
# container is bumped.
47-
default: '["ubuntu-22.04", "windows-2019", "macOS-13"]'
42+
default: '["ubuntu-24.04", "windows-2019", "macOS-13"]'
4843

4944
python_version:
5045
required: false
@@ -64,7 +59,7 @@ jobs:
6459
name: Lit Tests
6560
runs-on: ${{ matrix.os }}
6661
container:
67-
image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-22.04:latest') || null}}
62+
image: ${{(startsWith(matrix.os, 'ubuntu') && 'ghcr.io/llvm/ci-ubuntu-24.04:latest') || null}}
6863
volumes:
6964
- /mnt/:/mnt/
7065
strategy:

.github/workflows/spirv-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
build_target: check-llvm-codegen-spirv
2727
projects:
2828
extra_cmake_args: '-DLLVM_TARGETS_TO_BUILD="SPIRV" -DLLVM_INCLUDE_SPIRV_TOOLS_TESTS=ON'
29-
os_list: '["ubuntu-22.04"]'
29+
os_list: '["ubuntu-24.04"]'

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,12 @@ class MCPlusBuilder {
577577
return getNoRegister();
578578
}
579579

580-
/// Returns the register used as call destination, or no-register, if not
581-
/// an indirect call. Sets IsAuthenticatedInternally if the instruction
582-
/// accepts a signed pointer as its operand and authenticates it internally.
580+
/// Returns the register used as the destination of an indirect branch or call
581+
/// instruction. Sets IsAuthenticatedInternally if the instruction accepts
582+
/// a signed pointer as its operand and authenticates it internally.
583583
virtual MCPhysReg
584-
getRegUsedAsCallDest(const MCInst &Inst,
585-
bool &IsAuthenticatedInternally) const {
584+
getRegUsedAsIndirectBranchDest(const MCInst &Inst,
585+
bool &IsAuthenticatedInternally) const {
586586
llvm_unreachable("not implemented");
587587
return getNoRegister();
588588
}

bolt/include/bolt/Passes/PAuthGadgetScanner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ raw_ostream &operator<<(raw_ostream &OS, const MCInstReference &);
175175

176176
namespace PAuthGadgetScanner {
177177

178-
class PacRetAnalysis;
179-
struct State;
178+
class SrcSafetyAnalysis;
179+
struct SrcState;
180180

181181
/// Description of a gadget kind that can be detected. Intended to be
182182
/// statically allocated to be attached to reports by reference.

bolt/lib/Core/BinaryContext.cpp

Lines changed: 35 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,21 @@ bool BinaryContext::analyzeJumpTable(const uint64_t Address,
579579
TrimmedSize = EntriesAsAddress->size();
580580
};
581581

582+
auto printEntryDiagnostics = [&](raw_ostream &OS,
583+
const BinaryFunction *TargetBF) {
584+
OS << "FAIL: function doesn't contain this address\n";
585+
if (!TargetBF)
586+
return;
587+
OS << " ! function containing this address: " << *TargetBF << '\n';
588+
if (!TargetBF->isFragment())
589+
return;
590+
OS << " ! is a fragment with parents: ";
591+
ListSeparator LS;
592+
for (BinaryFunction *Parent : TargetBF->ParentFragments)
593+
OS << LS << *Parent;
594+
OS << '\n';
595+
};
596+
582597
ErrorOr<const BinarySection &> Section = getSectionForAddress(Address);
583598
if (!Section)
584599
return false;
@@ -646,25 +661,8 @@ bool BinaryContext::analyzeJumpTable(const uint64_t Address,
646661

647662
// Function or one of its fragments.
648663
const BinaryFunction *TargetBF = getBinaryFunctionContainingAddress(Value);
649-
const bool DoesBelongToFunction =
650-
BF.containsAddress(Value) ||
651-
(TargetBF && areRelatedFragments(TargetBF, &BF));
652-
if (!DoesBelongToFunction) {
653-
LLVM_DEBUG({
654-
if (!BF.containsAddress(Value)) {
655-
dbgs() << "FAIL: function doesn't contain this address\n";
656-
if (TargetBF) {
657-
dbgs() << " ! function containing this address: "
658-
<< TargetBF->getPrintName() << '\n';
659-
if (TargetBF->isFragment()) {
660-
dbgs() << " ! is a fragment";
661-
for (BinaryFunction *Parent : TargetBF->ParentFragments)
662-
dbgs() << ", parent: " << Parent->getPrintName();
663-
dbgs() << '\n';
664-
}
665-
}
666-
}
667-
});
664+
if (!TargetBF || !areRelatedFragments(TargetBF, &BF)) {
665+
LLVM_DEBUG(printEntryDiagnostics(dbgs(), TargetBF));
668666
break;
669667
}
670668

@@ -703,10 +701,7 @@ void BinaryContext::populateJumpTables() {
703701
++JTI) {
704702
JumpTable *JT = JTI->second;
705703

706-
bool NonSimpleParent = false;
707-
for (BinaryFunction *BF : JT->Parents)
708-
NonSimpleParent |= !BF->isSimple();
709-
if (NonSimpleParent)
704+
if (!llvm::all_of(JT->Parents, std::mem_fn(&BinaryFunction::isSimple)))
710705
continue;
711706

712707
uint64_t NextJTAddress = 0;
@@ -840,33 +835,25 @@ BinaryContext::getOrCreateJumpTable(BinaryFunction &Function, uint64_t Address,
840835
assert(JT->Type == Type && "jump table types have to match");
841836
assert(Address == JT->getAddress() && "unexpected non-empty jump table");
842837

843-
// Prevent associating a jump table to a specific fragment twice.
844-
if (!llvm::is_contained(JT->Parents, &Function)) {
845-
assert(llvm::all_of(JT->Parents,
846-
[&](const BinaryFunction *BF) {
847-
return areRelatedFragments(&Function, BF);
848-
}) &&
849-
"cannot re-use jump table of a different function");
850-
// Duplicate the entry for the parent function for easy access
851-
JT->Parents.push_back(&Function);
852-
if (opts::Verbosity > 2) {
853-
this->outs() << "BOLT-INFO: Multiple fragments access same jump table: "
854-
<< JT->Parents[0]->getPrintName() << "; "
855-
<< Function.getPrintName() << "\n";
856-
JT->print(this->outs());
857-
}
858-
Function.JumpTables.emplace(Address, JT);
859-
for (BinaryFunction *Parent : JT->Parents)
860-
Parent->setHasIndirectTargetToSplitFragment(true);
861-
}
838+
if (llvm::is_contained(JT->Parents, &Function))
839+
return JT->getFirstLabel();
862840

863-
bool IsJumpTableParent = false;
864-
(void)IsJumpTableParent;
865-
for (BinaryFunction *Frag : JT->Parents)
866-
if (Frag == &Function)
867-
IsJumpTableParent = true;
868-
assert(IsJumpTableParent &&
841+
// Prevent associating a jump table to a specific fragment twice.
842+
auto isSibling = std::bind(&BinaryContext::areRelatedFragments, this,
843+
&Function, std::placeholders::_1);
844+
assert(llvm::all_of(JT->Parents, isSibling) &&
869845
"cannot re-use jump table of a different function");
846+
if (opts::Verbosity > 2) {
847+
this->outs() << "BOLT-INFO: multiple fragments access the same jump table"
848+
<< ": " << *JT->Parents[0] << "; " << Function << '\n';
849+
JT->print(this->outs());
850+
}
851+
if (JT->Parents.size() == 1)
852+
JT->Parents.front()->setHasIndirectTargetToSplitFragment(true);
853+
Function.setHasIndirectTargetToSplitFragment(true);
854+
// Duplicate the entry for the parent function for easy access
855+
JT->Parents.push_back(&Function);
856+
Function.JumpTables.emplace(Address, JT);
870857
return JT->getFirstLabel();
871858
}
872859

0 commit comments

Comments
 (0)