Skip to content

Commit eecea5b

Browse files
author
joaosaffran
committed
Merge branch 'main' into obj2yaml/root-descriptors
2 parents d982395 + 80182a7 commit eecea5b

File tree

2,545 files changed

+194862
-90628
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,545 files changed

+194862
-90628
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"

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
/mlir/**/Transforms/SROA.* @moxinilian
129129

130130
# BOLT
131-
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci @yota9
131+
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @yota9
132132

133133
# Bazel build system.
134134
/utils/bazel/ @rupprecht @keith @aaronmondal

.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/**/*

bolt/include/bolt/Profile/DataAggregator.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,16 @@ class DataAggregator : public DataReader {
223223
bool recordExit(BinaryFunction &BF, uint64_t From, bool Mispred,
224224
uint64_t Count = 1) const;
225225

226-
/// Aggregation statistics
226+
/// Branch stacks aggregation statistics
227+
uint64_t NumTraces{0};
227228
uint64_t NumInvalidTraces{0};
228229
uint64_t NumLongRangeTraces{0};
229230
/// Specifies how many samples were recorded in cold areas if we are dealing
230231
/// with profiling data collected in a bolted binary. For LBRs, incremented
231232
/// for the source of the branch to avoid counting cold activity twice (one
232233
/// for source and another for destination).
233234
uint64_t NumColdSamples{0};
235+
uint64_t NumTotalSamples{0};
234236

235237
/// Looks into system PATH for Linux Perf and set up the aggregator to use it
236238
void findPerfExecutable();
@@ -327,8 +329,8 @@ class DataAggregator : public DataReader {
327329
/// Parse a single LBR entry as output by perf script -Fbrstack
328330
ErrorOr<LBREntry> parseLBREntry();
329331

330-
/// Parse LBR sample, returns the number of traces.
331-
uint64_t parseLBRSample(const PerfBranchSample &Sample, bool NeedsSkylakeFix);
332+
/// Parse LBR sample.
333+
void parseLBRSample(const PerfBranchSample &Sample, bool NeedsSkylakeFix);
332334

333335
/// Parse and pre-aggregate branch events.
334336
std::error_code parseBranchEvents();
@@ -487,6 +489,13 @@ class DataAggregator : public DataReader {
487489
void dump(const PerfBranchSample &Sample) const;
488490
void dump(const PerfMemSample &Sample) const;
489491

492+
/// Profile diagnostics print methods
493+
void printColdSamplesDiagnostic() const;
494+
void printLongRangeTracesDiagnostic() const;
495+
void printBranchSamplesDiagnostics() const;
496+
void printBasicSamplesDiagnostics(uint64_t OutOfRangeSamples) const;
497+
void printBranchStacksDiagnostics(uint64_t IgnoredSamples) const;
498+
490499
public:
491500
/// If perf.data was collected without build ids, the buildid-list may contain
492501
/// incomplete entries. Return true if the buffer containing

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2376,7 +2376,7 @@ Error BinaryFunction::buildCFG(MCPlusBuilder::AllocatorIdTy AllocatorId) {
23762376
// Without doing jump table value profiling we don't have a use for extra
23772377
// (duplicate) branches.
23782378
llvm::sort(TakenBranches);
2379-
auto NewEnd = std::unique(TakenBranches.begin(), TakenBranches.end());
2379+
auto NewEnd = llvm::unique(TakenBranches);
23802380
TakenBranches.erase(NewEnd, TakenBranches.end());
23812381

23822382
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

0 commit comments

Comments
 (0)