Skip to content

Commit 581a313

Browse files
authored
Merge branch 'main' into minnum_ieee_ppc
2 parents 682b443 + c7ea01b commit 581a313

File tree

2,484 files changed

+250923
-33947
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,484 files changed

+250923
-33947
lines changed

.ci/compute_projects.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
"clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"},
5353
"clang-tools-extra": {"libc"},
5454
"mlir": {"flang"},
55+
# Test everything if ci scripts are changed.
56+
# FIXME: Figure out what is missing and add here.
57+
".ci": {"llvm", "clang", "lld", "lldb"},
5558
}
5659

5760
DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}}
@@ -130,12 +133,11 @@ def _add_dependencies(projects: Set[str]) -> Set[str]:
130133
def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]:
131134
projects_to_test = set()
132135
for modified_project in modified_projects:
133-
# Skip all projects where we cannot run tests.
134-
if modified_project not in PROJECT_CHECK_TARGETS:
135-
continue
136136
if modified_project in RUNTIMES:
137137
continue
138-
projects_to_test.add(modified_project)
138+
# Skip all projects where we cannot run tests.
139+
if modified_project in PROJECT_CHECK_TARGETS:
140+
projects_to_test.add(modified_project)
139141
if modified_project not in DEPENDENTS_TO_TEST:
140142
continue
141143
for dependent_project in DEPENDENTS_TO_TEST[modified_project]:

.ci/compute_projects_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,23 @@ def test_exclude_gn(self):
188188
self.assertEqual(env_variables["runtimes_to_build"], "")
189189
self.assertEqual(env_variables["runtimes_check_targets"], "")
190190

191+
def test_ci(self):
192+
env_variables = compute_projects.get_env_variables(
193+
[".ci/compute_projects.py"], "Linux"
194+
)
195+
self.assertEqual(env_variables["projects_to_build"], "clang;lld;llvm;lldb")
196+
self.assertEqual(
197+
env_variables["project_check_targets"],
198+
"check-clang check-lld check-llvm check-lldb",
199+
)
200+
self.assertEqual(
201+
env_variables["runtimes_to_build"], "libcxx;libcxxabi;libunwind"
202+
)
203+
self.assertEqual(
204+
env_variables["runtimes_check_targets"],
205+
"check-cxx check-cxxabi check-unwind",
206+
)
207+
191208

192209
if __name__ == "__main__":
193210
unittest.main()

.ci/monolithic-linux.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
2828
ccache --clear
2929
fi
3030

31+
mkdir -p artifacts/reproducers
32+
33+
# Make sure any clang reproducers will end up as artifacts.
34+
export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`
35+
3136
function at-exit {
3237
retcode=$?
3338

34-
mkdir -p artifacts
3539
ccache --print-stats > artifacts/ccache_stats.txt
3640
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
3741

@@ -58,9 +62,18 @@ export PIP_BREAK_SYSTEM_PACKAGES=1
5862
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
5963
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
6064
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
65+
66+
# Set the system llvm-symbolizer as preferred.
67+
export LLVM_SYMBOLIZER_PATH=`which llvm-symbolizer`
68+
[[ ! -f "${LLVM_SYMBOLIZER_PATH}" ]] && echo "llvm-symbolizer not found!"
69+
70+
# Set up all runtimes either way. libcxx is a dependency of LLDB.
71+
# It will not be built unless it is used.
6172
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6273
-D LLVM_ENABLE_PROJECTS="${projects}" \
74+
-D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
6375
-G Ninja \
76+
-D CMAKE_PREFIX_PATH="${HOME}/.local" \
6477
-D CMAKE_BUILD_TYPE=Release \
6578
-D LLVM_ENABLE_ASSERTIONS=ON \
6679
-D LLVM_BUILD_EXAMPLES=ON \
@@ -69,7 +82,10 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6982
-D LLVM_ENABLE_LLD=ON \
7083
-D CMAKE_CXX_FLAGS=-gmlt \
7184
-D LLVM_CCACHE_BUILD=ON \
85+
-D LIBCXX_CXX_ABI=libcxxabi \
7286
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
87+
-D LLDB_ENABLE_PYTHON=ON \
88+
-D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
7389
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
7490

7591
echo "--- ninja"

.clang-format-ignore

Whitespace-only changes.

.github/new-prs-labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ ClangIR:
77
- clang/tools/cir-*/**/*
88
- clang/test/CIR/**/*
99

10+
clang:bytecode:
11+
- clang/docs/ConstantInterpreter.rst
12+
- clang/lib/AST/ByteCode/**/*
13+
- clang/test/AST/ByteCode/**/*
14+
- clang/unittests/AST/ByteCode/**/*
15+
1016
clang:dataflow:
1117
- clang/include/clang/Analysis/FlowSensitive/**/*
1218
- clang/lib/Analysis/FlowSensitive/**/*

.github/workflows/libc-fullbuild-tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
include:
2020
- os: ubuntu-24.04
2121
ccache-variant: sccache
22-
c_compiler: clang
23-
cpp_compiler: clang++
22+
c_compiler: clang-20
23+
cpp_compiler: clang++-20
2424
# TODO: remove ccache logic when https://github.com/hendrikmuhs/ccache-action/issues/279 is resolved.
2525
- os: ubuntu-24.04-arm
2626
ccache-variant: ccache
27-
c_compiler: clang
28-
cpp_compiler: clang++
27+
c_compiler: clang-20
28+
cpp_compiler: clang++-20
2929
# TODO: add back gcc build when it is fixed
3030
# - c_compiler: gcc
3131
# cpp_compiler: g++
@@ -51,6 +51,9 @@ jobs:
5151
# For more information, see https://wiki.debian.org/Multiarch/LibraryPathOverview
5252
- name: Prepare dependencies (Ubuntu)
5353
run: |
54+
wget https://apt.llvm.org/llvm.sh
55+
chmod +x llvm.sh
56+
sudo ./llvm.sh 20
5457
sudo apt-get update
5558
sudo apt-get install -y libmpfr-dev libgmp-dev libmpc-dev ninja-build linux-libc-dev
5659
sudo ln -sf /usr/include/$(uname -p)-linux-gnu/asm /usr/include/asm

.github/workflows/premerge.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- name: Upload Artifacts
7070
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
7171
with:
72-
name: Premerge Artifacts
72+
name: Premerge Artifacts (Linux)
7373
path: artifacts/
7474
retention-days: 5
7575
include-hidden-files: 'true'
@@ -124,7 +124,7 @@ jobs:
124124
- name: Upload Artifacts
125125
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
126126
with:
127-
name: Premerge Artifacts
127+
name: Premerge Artifacts (Windows)
128128
path: artifacts/
129129
retention-days: 5
130130
include-hidden-files: 'true'

bolt/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ endforeach()
8282

8383
set(BOLT_ENABLE_RUNTIME_default OFF)
8484
if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64"
85-
OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$")
85+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$"
86+
OR CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
8687
AND (CMAKE_SYSTEM_NAME STREQUAL "Linux"
8788
OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
8889
AND (NOT CMAKE_CROSSCOMPILING))
@@ -136,7 +137,7 @@ if (LLVM_INCLUDE_TESTS)
136137
endif()
137138

138139
if (BOLT_ENABLE_RUNTIME)
139-
message(STATUS "Building BOLT runtime libraries for X86")
140+
message(STATUS "Building BOLT runtime libraries for ${CMAKE_SYSTEM_PROCESSOR}")
140141
set(extra_args "")
141142
if(CMAKE_SYSROOT)
142143
list(APPEND extra_args -DCMAKE_SYSROOT=${CMAKE_SYSROOT})

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,11 @@ class BinaryFunction {
11741174
return getSecondaryEntryPointSymbol(BB.getLabel());
11751175
}
11761176

1177+
/// Remove a label from the secondary entry point map.
1178+
void removeSymbolFromSecondaryEntryPointMap(const MCSymbol *Label) {
1179+
SecondaryEntryPoints.erase(Label);
1180+
}
1181+
11771182
/// Return true if the basic block is an entry point into the function
11781183
/// (either primary or secondary).
11791184
bool isEntryPoint(const BinaryBasicBlock &BB) const {
@@ -2126,6 +2131,10 @@ class BinaryFunction {
21262131
return Islands && !Islands->DataOffsets.empty();
21272132
}
21282133

2134+
bool isStartOfConstantIsland(uint64_t Offset) const {
2135+
return hasConstantIsland() && Islands->DataOffsets.count(Offset);
2136+
}
2137+
21292138
/// Return true iff the symbol could be seen inside this function otherwise
21302139
/// it is probably another function.
21312140
bool isSymbolValidInScope(const SymbolRef &Symbol, uint64_t SymbolSize) const;

bolt/lib/Core/BinaryBasicBlock.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,7 @@ void BinaryBasicBlock::updateJumpTableSuccessors() {
372372
[](const BinaryBasicBlock *BB1, const BinaryBasicBlock *BB2) {
373373
return BB1->getInputOffset() < BB2->getInputOffset();
374374
});
375-
SuccessorBBs.erase(std::unique(SuccessorBBs.begin(), SuccessorBBs.end()),
376-
SuccessorBBs.end());
375+
SuccessorBBs.erase(llvm::unique(SuccessorBBs), SuccessorBBs.end());
377376

378377
for (BinaryBasicBlock *BB : SuccessorBBs)
379378
addSuccessor(BB);

bolt/lib/Core/BinaryEmitter.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,10 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
373373
Streamer.emitLabel(StartSymbol);
374374
}
375375

376+
const bool NeedsFDE =
377+
Function.hasCFI() && !(Function.isPatch() && Function.isAnonymous());
376378
// Emit CFI start
377-
if (Function.hasCFI()) {
379+
if (NeedsFDE) {
378380
Streamer.emitCFIStartProc(/*IsSimple=*/false);
379381
if (Function.getPersonalityFunction() != nullptr)
380382
Streamer.emitCFIPersonality(Function.getPersonalityFunction(),
@@ -421,7 +423,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
421423
Streamer.emitBytes(BC.MIB->getTrapFillValue());
422424

423425
// Emit CFI end
424-
if (Function.hasCFI())
426+
if (NeedsFDE)
425427
Streamer.emitCFIEndProc();
426428

427429
MCSymbol *EndSymbol = Function.getFunctionEndLabel(FF.getFragmentNum());

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,15 @@ void BinaryFunction::postProcessEntryPoints() {
18961896
if (BC.isAArch64() && Offset == getSize())
18971897
continue;
18981898

1899+
// If we have grabbed a wrong code label which actually points to some
1900+
// constant island inside the function, ignore this label and remove it
1901+
// from the secondary entry point map.
1902+
if (isStartOfConstantIsland(Offset)) {
1903+
BC.SymbolToFunctionMap.erase(Label);
1904+
removeSymbolFromSecondaryEntryPointMap(Label);
1905+
continue;
1906+
}
1907+
18991908
BC.errs() << "BOLT-WARNING: reference in the middle of instruction "
19001909
"detected in function "
19011910
<< *this << " at offset 0x" << Twine::utohexstr(Offset) << '\n';
@@ -2367,7 +2376,7 @@ Error BinaryFunction::buildCFG(MCPlusBuilder::AllocatorIdTy AllocatorId) {
23672376
// Without doing jump table value profiling we don't have a use for extra
23682377
// (duplicate) branches.
23692378
llvm::sort(TakenBranches);
2370-
auto NewEnd = std::unique(TakenBranches.begin(), TakenBranches.end());
2379+
auto NewEnd = llvm::unique(TakenBranches);
23712380
TakenBranches.erase(NewEnd, TakenBranches.end());
23722381

23732382
for (std::pair<uint32_t, uint32_t> &Branch : TakenBranches) {

bolt/lib/Core/DebugNames.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,7 @@ void DWARF5AcceleratorTable::computeBucketCount() {
440440
for (const auto &E : Entries)
441441
Uniques.push_back(E.second.HashValue);
442442
array_pod_sort(Uniques.begin(), Uniques.end());
443-
std::vector<uint32_t>::iterator P =
444-
std::unique(Uniques.begin(), Uniques.end());
443+
std::vector<uint32_t>::iterator P = llvm::unique(Uniques);
445444

446445
UniqueHashCount = std::distance(Uniques.begin(), P);
447446

bolt/lib/Core/Relocation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ static bool isSupportedRISCV(uint32_t Type) {
123123
case ELF::R_RISCV_LO12_S:
124124
case ELF::R_RISCV_64:
125125
case ELF::R_RISCV_TLS_GOT_HI20:
126+
case ELF::R_RISCV_TLS_GD_HI20:
126127
case ELF::R_RISCV_TPREL_HI20:
127128
case ELF::R_RISCV_TPREL_ADD:
128129
case ELF::R_RISCV_TPREL_LO12_I:
@@ -236,6 +237,7 @@ static size_t getSizeForTypeRISCV(uint32_t Type) {
236237
case ELF::R_RISCV_64:
237238
case ELF::R_RISCV_GOT_HI20:
238239
case ELF::R_RISCV_TLS_GOT_HI20:
240+
case ELF::R_RISCV_TLS_GD_HI20:
239241
// See extractValueRISCV for why this is necessary.
240242
return 8;
241243
}
@@ -491,6 +493,7 @@ static uint64_t extractValueRISCV(uint32_t Type, uint64_t Contents,
491493
return extractBImmRISCV(Contents);
492494
case ELF::R_RISCV_GOT_HI20:
493495
case ELF::R_RISCV_TLS_GOT_HI20:
496+
case ELF::R_RISCV_TLS_GD_HI20:
494497
// We need to know the exact address of the GOT entry so we extract the
495498
// value from both the AUIPC and L[D|W]. We cannot rely on the symbol in the
496499
// relocation for this since it simply refers to the object that is stored
@@ -707,6 +710,7 @@ static bool isPCRelativeRISCV(uint32_t Type) {
707710
case ELF::R_RISCV_RVC_BRANCH:
708711
case ELF::R_RISCV_32_PCREL:
709712
case ELF::R_RISCV_TLS_GOT_HI20:
713+
case ELF::R_RISCV_TLS_GD_HI20:
710714
return true;
711715
}
712716
}

bolt/lib/Profile/YAMLProfileWriter.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,9 @@ std::vector<yaml::bolt::PseudoProbeInfo>
133133
YAMLProfileWriter::convertNodeProbes(NodeIdToProbes &NodeProbes) {
134134
struct BlockProbeInfoHasher {
135135
size_t operator()(const yaml::bolt::PseudoProbeInfo &BPI) const {
136-
auto HashCombine = [](auto &Range) {
137-
return llvm::hash_combine_range(Range.begin(), Range.end());
138-
};
139-
return llvm::hash_combine(HashCombine(BPI.BlockProbes),
140-
HashCombine(BPI.CallProbes),
141-
HashCombine(BPI.IndCallProbes));
136+
return llvm::hash_combine(llvm::hash_combine_range(BPI.BlockProbes),
137+
llvm::hash_combine_range(BPI.CallProbes),
138+
llvm::hash_combine_range(BPI.IndCallProbes));
142139
}
143140
};
144141

0 commit comments

Comments
 (0)