Skip to content

Commit 27f4b3b

Browse files
Merge branch 'llvm:main' into unifi
2 parents 20b2dca + a0c5f19 commit 27f4b3b

File tree

3,855 files changed

+197362
-81414
lines changed

Some content is hidden

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

3,855 files changed

+197362
-81414
lines changed

.ci/compute_projects.py

Lines changed: 91 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,22 @@
4949
},
5050
"lld": {"bolt", "cross-project-tests"},
5151
# TODO(issues/132795): LLDB should be enabled on clang changes.
52-
"clang": {"clang-tools-extra", "compiler-rt", "cross-project-tests"},
53-
"clang-tools-extra": {"libc"},
52+
"clang": {"clang-tools-extra", "cross-project-tests"},
5453
"mlir": {"flang"},
5554
# Test everything if ci scripts are changed.
56-
# FIXME: Figure out what is missing and add here.
57-
".ci": {"llvm", "clang", "lld", "lldb"},
55+
".ci": {
56+
"llvm",
57+
"clang",
58+
"lld",
59+
"lldb",
60+
"bolt",
61+
"clang-tools-extra",
62+
"mlir",
63+
"polly",
64+
"flang",
65+
"libclc",
66+
"openmp",
67+
},
5868
}
5969

6070
# This mapping describes runtimes that should be enabled for a specific project,
@@ -64,7 +74,17 @@
6474

6575
# This mapping describes runtimes that should be tested when the key project is
6676
# touched.
67-
DEPENDENT_RUNTIMES_TO_TEST = {"clang": {"libcxx", "libcxxabi", "libunwind"}}
77+
DEPENDENT_RUNTIMES_TO_TEST = {
78+
"clang": {"compiler-rt"},
79+
"clang-tools-extra": {"libc"},
80+
"libc": {"libc"},
81+
".ci": {"compiler-rt", "libc"},
82+
}
83+
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {
84+
"llvm": {"libcxx", "libcxxabi", "libunwind"},
85+
"clang": {"libcxx", "libcxxabi", "libunwind"},
86+
".ci": {"libcxx", "libcxxabi", "libunwind"},
87+
}
6888

6989
EXCLUDE_LINUX = {
7090
"cross-project-tests", # TODO(issues/132796): Tests are failing.
@@ -93,9 +113,6 @@
93113
"cross-project-tests",
94114
"flang",
95115
"libc",
96-
"libcxx",
97-
"libcxxabi",
98-
"libunwind",
99116
"lldb",
100117
"openmp",
101118
"polly",
@@ -122,21 +139,35 @@
122139
"polly": "check-polly",
123140
}
124141

125-
RUNTIMES = {"libcxx", "libcxxabi", "libunwind"}
142+
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc"}
126143

127144

128-
def _add_dependencies(projects: Set[str]) -> Set[str]:
145+
def _add_dependencies(projects: Set[str], runtimes: Set[str]) -> Set[str]:
129146
projects_with_dependents = set(projects)
130147
current_projects_count = 0
131148
while current_projects_count != len(projects_with_dependents):
132149
current_projects_count = len(projects_with_dependents)
133150
for project in list(projects_with_dependents):
134-
if project not in PROJECT_DEPENDENCIES:
135-
continue
136-
projects_with_dependents.update(PROJECT_DEPENDENCIES[project])
151+
if project in PROJECT_DEPENDENCIES:
152+
projects_with_dependents.update(PROJECT_DEPENDENCIES[project])
153+
for runtime in runtimes:
154+
if runtime in PROJECT_DEPENDENCIES:
155+
projects_with_dependents.update(PROJECT_DEPENDENCIES[runtime])
137156
return projects_with_dependents
138157

139158

159+
def _exclude_projects(current_projects: Set[str], platform: str) -> Set[str]:
160+
if platform == "Linux":
161+
to_exclude = EXCLUDE_LINUX
162+
elif platform == "Windows":
163+
to_exclude = EXCLUDE_WINDOWS
164+
elif platform == "Darwin":
165+
to_exclude = EXCLUDE_MAC
166+
else:
167+
raise ValueError(f"Unexpected platform: {platform}")
168+
return current_projects.difference(to_exclude)
169+
170+
140171
def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]:
141172
projects_to_test = set()
142173
for modified_project in modified_projects:
@@ -154,54 +185,52 @@ def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set
154185
):
155186
continue
156187
projects_to_test.add(dependent_project)
157-
if platform == "Linux":
158-
for to_exclude in EXCLUDE_LINUX:
159-
if to_exclude in projects_to_test:
160-
projects_to_test.remove(to_exclude)
161-
elif platform == "Windows":
162-
for to_exclude in EXCLUDE_WINDOWS:
163-
if to_exclude in projects_to_test:
164-
projects_to_test.remove(to_exclude)
165-
elif platform == "Darwin":
166-
for to_exclude in EXCLUDE_MAC:
167-
if to_exclude in projects_to_test:
168-
projects_to_test.remove(to_exclude)
169-
else:
170-
raise ValueError("Unexpected platform.")
188+
projects_to_test = _exclude_projects(projects_to_test, platform)
171189
return projects_to_test
172190

173191

174-
def _compute_projects_to_build(projects_to_test: Set[str]) -> Set[str]:
175-
return _add_dependencies(projects_to_test)
192+
def _compute_projects_to_build(
193+
projects_to_test: Set[str], runtimes: Set[str]
194+
) -> Set[str]:
195+
return _add_dependencies(projects_to_test, runtimes)
176196

177197

178198
def _compute_project_check_targets(projects_to_test: Set[str]) -> Set[str]:
179199
check_targets = set()
180200
for project_to_test in projects_to_test:
181-
if project_to_test not in PROJECT_CHECK_TARGETS:
182-
continue
183-
check_targets.add(PROJECT_CHECK_TARGETS[project_to_test])
201+
if project_to_test in PROJECT_CHECK_TARGETS:
202+
check_targets.add(PROJECT_CHECK_TARGETS[project_to_test])
184203
return check_targets
185204

186205

187-
def _compute_runtimes_to_test(projects_to_test: Set[str]) -> Set[str]:
206+
def _compute_runtimes_to_test(modified_projects: Set[str], platform: str) -> Set[str]:
188207
runtimes_to_test = set()
189-
for project_to_test in projects_to_test:
190-
if project_to_test in DEPENDENT_RUNTIMES_TO_TEST:
191-
runtimes_to_test.update(DEPENDENT_RUNTIMES_TO_TEST[project_to_test])
192-
if project_to_test in DEPENDENT_RUNTIMES_TO_BUILD:
193-
runtimes_to_test.update(DEPENDENT_RUNTIMES_TO_BUILD[project_to_test])
194-
return runtimes_to_test
208+
for modified_project in modified_projects:
209+
if modified_project in DEPENDENT_RUNTIMES_TO_TEST:
210+
runtimes_to_test.update(DEPENDENT_RUNTIMES_TO_TEST[modified_project])
211+
return _exclude_projects(runtimes_to_test, platform)
195212

196213

197-
def _compute_runtime_check_targets(projects_to_test: Set[str]) -> Set[str]:
198-
check_targets = set()
199-
for project_to_test in projects_to_test:
200-
if project_to_test not in DEPENDENT_RUNTIMES_TO_TEST:
201-
continue
202-
for runtime_to_test in DEPENDENT_RUNTIMES_TO_TEST[project_to_test]:
203-
check_targets.add(PROJECT_CHECK_TARGETS[runtime_to_test])
204-
return check_targets
214+
def _compute_runtimes_to_test_needs_reconfig(
215+
modified_projects: Set[str], platform: str
216+
) -> Set[str]:
217+
runtimes_to_test = set()
218+
for modified_project in modified_projects:
219+
if modified_project in DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG:
220+
runtimes_to_test.update(
221+
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG[modified_project]
222+
)
223+
return _exclude_projects(runtimes_to_test, platform)
224+
225+
226+
def _compute_runtimes_to_build(
227+
runtimes_to_test: Set[str], modified_projects: Set[str], platform: str
228+
) -> Set[str]:
229+
runtimes_to_build = set(runtimes_to_test)
230+
for modified_project in modified_projects:
231+
if modified_project in DEPENDENT_RUNTIMES_TO_BUILD:
232+
runtimes_to_build.update(DEPENDENT_RUNTIMES_TO_BUILD[modified_project])
233+
return _exclude_projects(runtimes_to_build, platform)
205234

206235

207236
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
@@ -225,10 +254,19 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
225254
def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
226255
modified_projects = _get_modified_projects(modified_files)
227256
projects_to_test = _compute_projects_to_test(modified_projects, platform)
228-
projects_to_build = _compute_projects_to_build(projects_to_test)
257+
runtimes_to_test = _compute_runtimes_to_test(modified_projects, platform)
258+
runtimes_to_test_needs_reconfig = _compute_runtimes_to_test_needs_reconfig(
259+
modified_projects, platform
260+
)
261+
runtimes_to_build = _compute_runtimes_to_build(
262+
runtimes_to_test | runtimes_to_test_needs_reconfig, modified_projects, platform
263+
)
264+
projects_to_build = _compute_projects_to_build(projects_to_test, runtimes_to_build)
229265
projects_check_targets = _compute_project_check_targets(projects_to_test)
230-
runtimes_to_build = _compute_runtimes_to_test(projects_to_test)
231-
runtimes_check_targets = _compute_runtime_check_targets(projects_to_test)
266+
runtimes_check_targets = _compute_project_check_targets(runtimes_to_test)
267+
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
268+
runtimes_to_test_needs_reconfig
269+
)
232270
# We use a semicolon to separate the projects/runtimes as they get passed
233271
# to the CMake invocation and thus we need to use the CMake list separator
234272
# (;). We use spaces to separate the check targets as they end up getting
@@ -238,6 +276,9 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
238276
"project_check_targets": " ".join(sorted(projects_check_targets)),
239277
"runtimes_to_build": ";".join(sorted(runtimes_to_build)),
240278
"runtimes_check_targets": " ".join(sorted(runtimes_check_targets)),
279+
"runtimes_check_targets_needs_reconfig": " ".join(
280+
sorted(runtimes_check_targets_needs_reconfig)
281+
),
241282
}
242283

243284

0 commit comments

Comments
 (0)