Skip to content

Commit 3f6a91a

Browse files
committed
Merge branch 'pgo-estimated-trip-count' into fix-peel-branch-weights
2 parents 859b84d + 6148922 commit 3f6a91a

File tree

6,325 files changed

+299908
-145622
lines changed

Some content is hidden

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

6,325 files changed

+299908
-145622
lines changed

.ci/compute_projects.py

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
PROJECT_DEPENDENCIES = {
2020
"llvm": set(),
2121
"clang": {"llvm"},
22+
"CIR": {"clang", "mlir"},
2223
"bolt": {"clang", "lld", "llvm"},
2324
"clang-tools-extra": {"clang", "llvm"},
2425
"compiler-rt": {"clang", "lld"},
@@ -55,6 +56,7 @@
5556
".ci": {
5657
"llvm",
5758
"clang",
59+
"CIR",
5860
"lld",
5961
"lldb",
6062
"bolt",
@@ -128,6 +130,7 @@
128130
"lldb": "check-lldb",
129131
"llvm": "check-llvm",
130132
"clang": "check-clang",
133+
"CIR": "check-clang-cir",
131134
"bolt": "check-bolt",
132135
"lld": "check-lld",
133136
"flang": "check-flang",
@@ -141,6 +144,23 @@
141144

142145
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc"}
143146

147+
# Meta projects are projects that need explicit handling but do not reside
148+
# in their own top level folder. To add a meta project, the start of the path
149+
# for the metaproject should be mapped to the name of the project below.
150+
# Multiple paths can map to the same metaproject.
151+
META_PROJECTS = {
152+
("clang", "lib", "CIR"): "CIR",
153+
("clang", "test", "CIR"): "CIR",
154+
("clang", "include", "clang", "CIR"): "CIR",
155+
("*", "docs"): "docs",
156+
("llvm", "utils", "gn"): "gn",
157+
(".github", "workflows", "premerge.yaml"): ".ci",
158+
("third-party",): ".ci",
159+
}
160+
161+
# Projects that should not run any tests. These need to be metaprojects.
162+
SKIP_PROJECTS = ["docs", "gn"]
163+
144164

145165
def _add_dependencies(projects: Set[str], runtimes: Set[str]) -> Set[str]:
146166
projects_with_dependents = set(projects)
@@ -233,21 +253,34 @@ def _compute_runtimes_to_build(
233253
return _exclude_projects(runtimes_to_build, platform)
234254

235255

256+
def _path_matches(matcher: tuple[str], file_path: tuple[str]) -> bool:
257+
if len(file_path) < len(matcher):
258+
return False
259+
for match_part, file_part in zip(matcher, file_path):
260+
if match_part == "*" or file_part == "*":
261+
continue
262+
if match_part != file_part:
263+
return False
264+
return True
265+
266+
267+
def _get_modified_projects_for_file(modified_file: str) -> Set[str]:
268+
modified_projects = set()
269+
path_parts = pathlib.Path(modified_file).parts
270+
for meta_project_files in META_PROJECTS.keys():
271+
if _path_matches(meta_project_files, path_parts):
272+
meta_project = META_PROJECTS[meta_project_files]
273+
if meta_project in SKIP_PROJECTS:
274+
return set()
275+
modified_projects.add(meta_project)
276+
modified_projects.add(pathlib.Path(modified_file).parts[0])
277+
return modified_projects
278+
279+
236280
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
237281
modified_projects = set()
238282
for modified_file in modified_files:
239-
path_parts = pathlib.Path(modified_file).parts
240-
# Exclude files in the docs directory. They do not impact an test
241-
# targets and there is a separate workflow used for ensuring the
242-
# documentation builds.
243-
if len(path_parts) > 2 and path_parts[1] == "docs":
244-
continue
245-
# Exclude files for the gn build. We do not test it within premerge
246-
# and changes occur often enough that they otherwise take up
247-
# capacity.
248-
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
249-
continue
250-
modified_projects.add(pathlib.Path(modified_file).parts[0])
283+
modified_projects.update(_get_modified_projects_for_file(modified_file))
251284
return modified_projects
252285

253286

@@ -267,6 +300,13 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
267300
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
268301
runtimes_to_test_needs_reconfig
269302
)
303+
304+
# CIR is used as a pseudo-project in this script. It is built as part of the
305+
# clang build, but it requires an explicit option to enable. We set that
306+
# option here, and remove it from the projects_to_build list.
307+
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
308+
projects_to_build.discard("CIR")
309+
270310
# We use a semicolon to separate the projects/runtimes as they get passed
271311
# to the CMake invocation and thus we need to use the CMake list separator
272312
# (;). We use spaces to separate the check targets as they end up getting
@@ -279,6 +319,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
279319
"runtimes_check_targets_needs_reconfig": " ".join(
280320
sorted(runtimes_check_targets_needs_reconfig)
281321
),
322+
"enable_cir": enable_cir,
282323
}
283324

284325

.ci/compute_projects_test.py

Lines changed: 95 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4-
"""Does some stuff."""
4+
"""Tests for compute_projects.py"""
55

66
import unittest
77

@@ -104,6 +104,10 @@ def test_clang(self):
104104
env_variables["runtimes_check_targets_needs_reconfig"],
105105
"check-cxx check-cxxabi check-unwind",
106106
)
107+
self.assertEqual(
108+
env_variables["enable_cir"],
109+
"OFF",
110+
)
107111

108112
def test_clang_windows(self):
109113
env_variables = compute_projects.get_env_variables(
@@ -126,6 +130,32 @@ def test_clang_windows(self):
126130
env_variables["runtimes_check_targets_needs_reconfig"],
127131
"check-cxx check-cxxabi check-unwind",
128132
)
133+
self.assertEqual(env_variables["enable_cir"], "OFF")
134+
135+
def test_cir(self):
136+
env_variables = compute_projects.get_env_variables(
137+
["clang/lib/CIR/CMakeLists.txt"], "Linux"
138+
)
139+
self.assertEqual(
140+
env_variables["projects_to_build"],
141+
"clang;clang-tools-extra;lld;llvm;mlir",
142+
)
143+
self.assertEqual(
144+
env_variables["project_check_targets"],
145+
"check-clang check-clang-cir check-clang-tools",
146+
)
147+
self.assertEqual(
148+
env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
149+
)
150+
self.assertEqual(
151+
env_variables["runtimes_check_targets"],
152+
"check-compiler-rt",
153+
)
154+
self.assertEqual(
155+
env_variables["runtimes_check_targets_needs_reconfig"],
156+
"check-cxx check-cxxabi check-unwind",
157+
)
158+
self.assertEqual(env_variables["enable_cir"], "ON")
129159

130160
def test_bolt(self):
131161
env_variables = compute_projects.get_env_variables(
@@ -158,6 +188,7 @@ def test_mlir(self):
158188
self.assertEqual(env_variables["runtimes_to_build"], "")
159189
self.assertEqual(env_variables["runtimes_check_targets"], "")
160190
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
191+
self.assertEqual(env_variables["enable_cir"], "OFF")
161192

162193
def test_flang(self):
163194
env_variables = compute_projects.get_env_variables(
@@ -168,10 +199,11 @@ def test_flang(self):
168199
self.assertEqual(env_variables["runtimes_to_build"], "")
169200
self.assertEqual(env_variables["runtimes_check_targets"], "")
170201
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
202+
self.assertEqual(env_variables["enable_cir"], "OFF")
171203

172204
def test_invalid_subproject(self):
173205
env_variables = compute_projects.get_env_variables(
174-
["third-party/benchmark/CMakeLists.txt"], "Linux"
206+
["llvm-libgcc/CMakeLists.txt"], "Linux"
175207
)
176208
self.assertEqual(env_variables["projects_to_build"], "")
177209
self.assertEqual(env_variables["project_check_targets"], "")
@@ -237,7 +269,7 @@ def test_ci(self):
237269
)
238270
self.assertEqual(
239271
env_variables["project_check_targets"],
240-
"check-bolt check-clang check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
272+
"check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
241273
)
242274
self.assertEqual(
243275
env_variables["runtimes_to_build"],
@@ -276,6 +308,66 @@ def test_clang_tools_extra(self):
276308
self.assertEqual(env_variables["runtimes_check_targets"], "check-libc")
277309
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
278310

311+
def test_premerge_workflow(self):
312+
env_variables = compute_projects.get_env_variables(
313+
[".github/workflows/premerge.yaml"], "Linux"
314+
)
315+
self.assertEqual(
316+
env_variables["projects_to_build"],
317+
"bolt;clang;clang-tools-extra;flang;libclc;lld;lldb;llvm;mlir;polly",
318+
)
319+
self.assertEqual(
320+
env_variables["project_check_targets"],
321+
"check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
322+
)
323+
self.assertEqual(
324+
env_variables["runtimes_to_build"],
325+
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
326+
)
327+
self.assertEqual(
328+
env_variables["runtimes_check_targets"],
329+
"check-compiler-rt check-libc",
330+
)
331+
self.assertEqual(
332+
env_variables["runtimes_check_targets_needs_reconfig"],
333+
"check-cxx check-cxxabi check-unwind",
334+
)
335+
336+
def test_other_github_workflow(self):
337+
env_variables = compute_projects.get_env_variables(
338+
[".github/workflows/docs.yml"], "Linux"
339+
)
340+
self.assertEqual(env_variables["projects_to_build"], "")
341+
self.assertEqual(env_variables["project_check_targets"], "")
342+
self.assertEqual(env_variables["runtimes_to_build"], "")
343+
self.assertEqual(env_variables["runtimes_check_targets"], "")
344+
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
345+
346+
def test_third_party_benchmark(self):
347+
env_variables = compute_projects.get_env_variables(
348+
["third-party/benchmark/CMakeLists.txt"], "Linux"
349+
)
350+
self.assertEqual(
351+
env_variables["projects_to_build"],
352+
"bolt;clang;clang-tools-extra;flang;libclc;lld;lldb;llvm;mlir;polly",
353+
)
354+
self.assertEqual(
355+
env_variables["project_check_targets"],
356+
"check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
357+
)
358+
self.assertEqual(
359+
env_variables["runtimes_to_build"],
360+
"compiler-rt;libc;libcxx;libcxxabi;libunwind",
361+
)
362+
self.assertEqual(
363+
env_variables["runtimes_check_targets"],
364+
"check-compiler-rt check-libc",
365+
)
366+
self.assertEqual(
367+
env_variables["runtimes_check_targets_needs_reconfig"],
368+
"check-cxx check-cxxabi check-unwind",
369+
)
370+
279371

280372
if __name__ == "__main__":
281373
unittest.main()

.ci/metrics/metrics.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
"""Collects Github metrics and uploads them to Grafana.
5+
6+
This script contains machinery that will pull metrics periodically from Github
7+
about workflow runs. It will upload the collected metrics to the specified
8+
Grafana instance.
9+
"""
10+
111
import collections
212
import datetime
313
import github

.ci/monolithic-linux.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
2121
INSTALL_DIR="${BUILD_DIR}/install"
2222
rm -rf "${BUILD_DIR}"
2323

24-
ccache --zero-stats
25-
26-
if [[ -n "${CLEAR_CACHE:-}" ]]; then
27-
echo "clearing cache"
28-
ccache --clear
29-
fi
24+
sccache --zero-stats
3025

3126
mkdir -p artifacts/reproducers
3227

@@ -36,7 +31,7 @@ export CLANG_CRASH_DIAGNOSTICS_DIR=`realpath artifacts/reproducers`
3631
function at-exit {
3732
retcode=$?
3833

39-
ccache --print-stats > artifacts/ccache_stats.txt
34+
sccache --show-stats > artifacts/sccache_stats.txt
4035
cp "${BUILD_DIR}"/.ninja_log artifacts/.ninja_log
4136
cp "${BUILD_DIR}"/test-results.*.xml artifacts/ || :
4237

@@ -53,6 +48,7 @@ targets="${2}"
5348
runtimes="${3}"
5449
runtime_targets="${4}"
5550
runtime_targets_needs_reconfig="${5}"
51+
enable_cir="${6}"
5652

5753
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
5854

@@ -72,13 +68,15 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
7268
-G Ninja \
7369
-D CMAKE_PREFIX_PATH="${HOME}/.local" \
7470
-D CMAKE_BUILD_TYPE=Release \
71+
-D CLANG_ENABLE_CIR=${enable_cir} \
7572
-D LLVM_ENABLE_ASSERTIONS=ON \
7673
-D LLVM_BUILD_EXAMPLES=ON \
7774
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \
7875
-D LLVM_LIT_ARGS="${lit_args}" \
7976
-D LLVM_ENABLE_LLD=ON \
8077
-D CMAKE_CXX_FLAGS=-gmlt \
81-
-D LLVM_CCACHE_BUILD=ON \
78+
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
79+
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
8280
-D LIBCXX_CXX_ABI=libcxxabi \
8381
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
8482
-D LLDB_ENABLE_PYTHON=ON \

.ci/monolithic-windows.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
2121

2222
rm -rf "${BUILD_DIR}"
2323

24-
if [[ -n "${CLEAR_CACHE:-}" ]]; then
25-
echo "clearing sccache"
26-
rm -rf "$SCCACHE_DIR"
27-
fi
28-
2924
sccache --zero-stats
3025
function at-exit {
3126
retcode=$?

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
/clang/www/cxx_dr_status.html @Endilll
3232
/clang/www/make_cxx_dr_status @Endilll
3333

34-
/clang/include/clang/CIR @lanza @bcardosolopes
35-
/clang/lib/CIR @lanza @bcardosolopes
36-
/clang/tools/cir-* @lanza @bcardosolopes
34+
/clang/include/clang/CIR @lanza @bcardosolopes @xlauko @andykaylor
35+
/clang/lib/CIR @lanza @bcardosolopes @xlauko @andykaylor
36+
/clang/tools/cir-* @lanza @bcardosolopes @xlauko @andykaylor
3737

3838
/lldb/ @JDevlieghere
3939

.github/new-prs-labeler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ flang:frontend:
4848
- flang/Evaluate/**/*
4949
- flang/Semantics/**/*
5050

51+
libclc:
52+
- libclc/**
53+
5154
HLSL:
5255
- clang/*HLSL*/**/*
5356
- clang/**/*HLSL*
@@ -717,6 +720,8 @@ mlgo:
717720
- llvm/lib/Analysis/IR2Vec.cpp
718721
- llvm/lib/Analysis/models/**
719722
- llvm/test/Analysis/IR2Vec/**
723+
- llvm/tools/llvm-ir2vec/**
724+
- llvm/docs/CommandGuide/llvm-ir2vec.rst
720725

721726
tools:llvm-exegesis:
722727
- llvm/tools/llvm-exegesis/**

.github/workflows/build-ci-container-windows.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ on:
1111
- .github/workflows/build-ci-container-windows.yml
1212
- '.github/workflows/containers/github-action-ci-windows/**'
1313
pull_request:
14-
branches:
15-
- main
1614
paths:
1715
- .github/workflows/build-ci-container-windows.yml
1816
- '.github/workflows/containers/github-action-ci-windows/**'

.github/workflows/build-ci-container.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ on:
1111
- .github/workflows/build-ci-container.yml
1212
- '.github/workflows/containers/github-action-ci/**'
1313
pull_request:
14-
branches:
15-
- main
1614
paths:
1715
- .github/workflows/build-ci-container.yml
1816
- '.github/workflows/containers/github-action-ci/**'

0 commit comments

Comments
 (0)