Skip to content

Commit 2f9ee24

Browse files
authored
Merge branch 'main' into tracing
2 parents 9fc1380 + 984251a commit 2f9ee24

File tree

5,471 files changed

+447888
-150749
lines changed

Some content is hidden

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

5,471 files changed

+447888
-150749
lines changed

.ci/compute_projects.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898

9999
EXCLUDE_WINDOWS = {
100100
"cross-project-tests", # TODO(issues/132797): Tests are failing.
101-
"compiler-rt", # TODO(issues/132798): Tests take excessive time.
102101
"openmp", # TODO(issues/132799): Does not detect perl installation.
103102
"libc", # No Windows Support.
104103
"lldb", # TODO(issues/132800): Needs environment setup.

.ci/compute_projects_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ def test_clang_windows(self):
110110
["clang/CMakeLists.txt"], "Windows"
111111
)
112112
self.assertEqual(
113-
env_variables["projects_to_build"], "clang;clang-tools-extra;llvm"
113+
env_variables["projects_to_build"], "clang;clang-tools-extra;lld;llvm"
114114
)
115115
self.assertEqual(
116116
env_variables["project_check_targets"], "check-clang check-clang-tools"
117117
)
118-
self.assertEqual(env_variables["runtimes_to_build"], "")
118+
self.assertEqual(env_variables["runtimes_to_build"], "compiler-rt")
119119
self.assertEqual(
120120
env_variables["runtimes_check_targets"],
121-
"",
121+
"check-compiler-rt",
122122
)
123123
self.assertEqual(
124124
env_variables["runtimes_check_targets_needs_reconfig"],
@@ -318,11 +318,11 @@ def test_windows_ci(self):
318318
)
319319
self.assertEqual(
320320
env_variables["runtimes_to_build"],
321-
"",
321+
"compiler-rt",
322322
)
323323
self.assertEqual(
324324
env_variables["runtimes_check_targets"],
325-
"",
325+
"check-compiler-rt",
326326
)
327327
self.assertEqual(
328328
env_variables["runtimes_check_targets_needs_reconfig"],

.ci/monolithic-linux.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6161
-D LLDB_ENABLE_PYTHON=ON \
6262
-D LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=ON \
6363
-D CMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
64-
-D CMAKE_EXE_LINKER_FLAGS="-no-pie"
64+
-D CMAKE_EXE_LINKER_FLAGS="-no-pie" \
65+
-D LLVM_ENABLE_WERROR=ON
6566

6667
start-group "ninja"
6768

.ci/monolithic-windows.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ source .ci/utils.sh
1717

1818
projects="${1}"
1919
targets="${2}"
20+
runtimes="${3}"
21+
runtimes_targets="${4}"
2022

2123
start-group "CMake"
2224
pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt
@@ -46,9 +48,16 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
4648
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
4749
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
4850
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
49-
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
51+
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \
52+
-D LLVM_ENABLE_RUNTIMES="${runtimes}"
5053

5154
start-group "ninja"
5255

5356
# Targets are not escaped as they are passed as separate arguments.
5457
ninja -C "${BUILD_DIR}" -k 0 ${targets} |& tee ninja.log
58+
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

.github/new-prs-labeler.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,14 @@ clang:openmp:
10901090
- llvm/unittests/Frontend/OpenMP*
10911091
- llvm/test/Transforms/OpenMP/**
10921092

1093+
clang:temporal-safety:
1094+
- clang/include/clang/Analysis/Analyses/LifetimeSafety*
1095+
- clang/lib/Analysis/LifetimeSafety*
1096+
- clang/unittests/Analysis/LifetimeSafety*
1097+
- clang/test/Sema/*lifetime-safety*
1098+
- clang/test/Sema/*lifetime-analysis*
1099+
- clang/test/Analysis/LifetimeSafety/**
1100+
10931101
clang:as-a-library:
10941102
- clang/tools/libclang/**
10951103
- clang/bindings/**

.github/workflows/premerge.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,21 @@ jobs:
108108
109109
echo "Building projects: ${projects_to_build}"
110110
echo "Running project checks targets: ${project_check_targets}"
111+
echo "Building runtimes: ${runtimes_to_build}"
112+
echo "Running runtimes checks targets: ${runtimes_check_targets}"
111113
112114
echo "windows-projects=${projects_to_build}" >> $GITHUB_OUTPUT
113115
echo "windows-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
116+
echo "windows-runtimes=${runtimes_to_build}" >> $GITHUB_OUTPUT
117+
echo "windows-runtimes-check-targets=${runtimes_check_targets}" >> $GITHUB_OUTPUT
114118
- name: Build and Test
115119
if: ${{ steps.vars.outputs.windows-projects != '' }}
116120
shell: cmd
117121
run: |
118122
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
119123
# See the comments above in the Linux job for why we define each of
120124
# these environment variables.
121-
bash -c "export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET; export SCCACHE_GCS_RW_MODE=READ_WRITE; export SCCACHE_IDLE_TIMEOUT=0; mkdir artifacts; SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server; .ci/monolithic-windows.sh \"${{ steps.vars.outputs.windows-projects }}\" \"${{ steps.vars.outputs.windows-check-targets }}\""
125+
bash -c "export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET; export SCCACHE_GCS_RW_MODE=READ_WRITE; export SCCACHE_IDLE_TIMEOUT=0; mkdir artifacts; SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server; .ci/monolithic-windows.sh \"${{ steps.vars.outputs.windows-projects }}\" \"${{ steps.vars.outputs.windows-check-targets }}\" \"${{ steps.vars.outputs.windows-runtimes }}\" \"${{ steps.vars.outputs.windows-runtimes-check-targets }}\""
122126
- name: Upload Artifacts
123127
# In some cases, Github will fail to upload the artifact. We want to
124128
# continue anyways as a failed artifact upload is an infra failure, not

bolt/docs/CommandLineArgumentReference.md

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

638638
- `--inline-memcpy`
639639

640-
Inline memcpy using 'rep movsb' instruction (X86-only)
640+
Inline memcpy using optimized instruction sequences (X86: 'rep movsb', AArch64: width-optimized register operations)
641641

642642
- `--inline-small-functions`
643643

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef BOLT_CORE_MCPLUSBUILDER_H
1515
#define BOLT_CORE_MCPLUSBUILDER_H
1616

17+
#include "bolt/Core/BinaryBasicBlock.h"
1718
#include "bolt/Core/MCPlus.h"
1819
#include "bolt/Core/Relocation.h"
1920
#include "llvm/ADT/ArrayRef.h"
@@ -1902,13 +1903,38 @@ class MCPlusBuilder {
19021903
return {};
19031904
}
19041905

1906+
/// Find memcpy size in bytes by using preceding instructions.
1907+
/// Returns std::nullopt if size cannot be determined (no-op for most
1908+
/// targets).
1909+
virtual std::optional<uint64_t>
1910+
findMemcpySizeInBytes(const BinaryBasicBlock &BB,
1911+
BinaryBasicBlock::iterator CallInst) const {
1912+
return std::nullopt;
1913+
}
1914+
19051915
/// Creates inline memcpy instruction. If \p ReturnEnd is true, then return
19061916
/// (dest + n) instead of dest.
19071917
virtual InstructionListType createInlineMemcpy(bool ReturnEnd) const {
19081918
llvm_unreachable("not implemented");
19091919
return {};
19101920
}
19111921

1922+
/// Creates size-aware inline memcpy instruction. If \p KnownSize is provided,
1923+
/// generates optimized code for that specific size. Falls back to regular
1924+
/// createInlineMemcpy if size is unknown or not needed (e.g. with X86).
1925+
virtual InstructionListType
1926+
createInlineMemcpy(bool ReturnEnd, std::optional<uint64_t> KnownSize) const {
1927+
return createInlineMemcpy(ReturnEnd);
1928+
}
1929+
1930+
/// Extract immediate value from move instruction that sets the given
1931+
/// register. Returns the immediate value if the instruction is a
1932+
/// move-immediate to TargetReg.
1933+
virtual std::optional<uint64_t>
1934+
extractMoveImmediate(const MCInst &Inst, MCPhysReg TargetReg) const {
1935+
return std::nullopt;
1936+
}
1937+
19121938
/// Create a target-specific relocation out of the \p Fixup.
19131939
/// Note that not every fixup could be converted into a relocation.
19141940
virtual std::optional<Relocation>

bolt/lib/Core/BinaryContext.cpp

Lines changed: 10 additions & 14 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),
@@ -1568,23 +1568,19 @@ unsigned BinaryContext::addDebugFilenameToUnit(const uint32_t DestCUID,
15681568
DWARFCompileUnit *SrcUnit = DwCtx->getCompileUnitForOffset(SrcCUID);
15691569
const DWARFDebugLine::LineTable *LineTable =
15701570
DwCtx->getLineTableForUnit(SrcUnit);
1571-
const std::vector<DWARFDebugLine::FileNameEntry> &FileNames =
1572-
LineTable->Prologue.FileNames;
1573-
// Dir indexes start at 1, as DWARF file numbers, and a dir index 0
1571+
const DWARFDebugLine::FileNameEntry &FileNameEntry =
1572+
LineTable->Prologue.getFileNameEntry(FileIndex);
1573+
// Dir indexes start at 1 and a dir index 0
15741574
// means empty dir.
1575-
assert(FileIndex > 0 && FileIndex <= FileNames.size() &&
1576-
"FileIndex out of range for the compilation unit.");
15771575
StringRef Dir = "";
1578-
if (FileNames[FileIndex - 1].DirIdx != 0) {
1576+
if (FileNameEntry.DirIdx != 0) {
15791577
if (std::optional<const char *> DirName = dwarf::toString(
1580-
LineTable->Prologue
1581-
.IncludeDirectories[FileNames[FileIndex - 1].DirIdx - 1])) {
1578+
LineTable->Prologue.IncludeDirectories[FileNameEntry.DirIdx - 1])) {
15821579
Dir = *DirName;
15831580
}
15841581
}
15851582
StringRef FileName = "";
1586-
if (std::optional<const char *> FName =
1587-
dwarf::toString(FileNames[FileIndex - 1].Name))
1583+
if (std::optional<const char *> FName = dwarf::toString(FileNameEntry.Name))
15881584
FileName = *FName;
15891585
assert(FileName != "");
15901586
DWARFCompileUnit *DstUnit = DwCtx->getCompileUnitForOffset(DestCUID);
@@ -1925,7 +1921,7 @@ static void printDebugInfo(raw_ostream &OS, const MCInst &Instruction,
19251921
const DWARFDebugLine::Row &Row = LineTable->Rows[RowRef.RowIndex - 1];
19261922
StringRef FileName = "";
19271923
if (std::optional<const char *> FName =
1928-
dwarf::toString(LineTable->Prologue.FileNames[Row.File - 1].Name))
1924+
dwarf::toString(LineTable->Prologue.getFileNameEntry(Row.File).Name))
19291925
FileName = *FName;
19301926
OS << " # debug line " << FileName << ":" << Row.Line;
19311927
if (Row.Column)

0 commit comments

Comments
 (0)