Skip to content

Commit 1df44db

Browse files
Merge branch 'llvm:main' into inline-assembly
2 parents fd302d3 + 40eee8e commit 1df44db

File tree

426 files changed

+16421
-4489
lines changed

Some content is hidden

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

426 files changed

+16421
-4489
lines changed

.ci/compute_projects.py

Lines changed: 90 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,16 @@
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+
".ci": {"compiler-rt", "libc"},
81+
}
82+
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {
83+
"llvm": {"libcxx", "libcxxabi", "libunwind"},
84+
"clang": {"libcxx", "libcxxabi", "libunwind"},
85+
".ci": {"libcxx", "libcxxabi", "libunwind"},
86+
}
6887

6988
EXCLUDE_LINUX = {
7089
"cross-project-tests", # TODO(issues/132796): Tests are failing.
@@ -93,9 +112,6 @@
93112
"cross-project-tests",
94113
"flang",
95114
"libc",
96-
"libcxx",
97-
"libcxxabi",
98-
"libunwind",
99115
"lldb",
100116
"openmp",
101117
"polly",
@@ -122,21 +138,35 @@
122138
"polly": "check-polly",
123139
}
124140

125-
RUNTIMES = {"libcxx", "libcxxabi", "libunwind"}
141+
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc"}
126142

127143

128-
def _add_dependencies(projects: Set[str]) -> Set[str]:
144+
def _add_dependencies(projects: Set[str], runtimes: Set[str]) -> Set[str]:
129145
projects_with_dependents = set(projects)
130146
current_projects_count = 0
131147
while current_projects_count != len(projects_with_dependents):
132148
current_projects_count = len(projects_with_dependents)
133149
for project in list(projects_with_dependents):
134-
if project not in PROJECT_DEPENDENCIES:
135-
continue
136-
projects_with_dependents.update(PROJECT_DEPENDENCIES[project])
150+
if project in PROJECT_DEPENDENCIES:
151+
projects_with_dependents.update(PROJECT_DEPENDENCIES[project])
152+
for runtime in runtimes:
153+
if runtime in PROJECT_DEPENDENCIES:
154+
projects_with_dependents.update(PROJECT_DEPENDENCIES[runtime])
137155
return projects_with_dependents
138156

139157

158+
def _exclude_projects(current_projects: Set[str], platform: str) -> Set[str]:
159+
if platform == "Linux":
160+
to_exclude = EXCLUDE_LINUX
161+
elif platform == "Windows":
162+
to_exclude = EXCLUDE_WINDOWS
163+
elif platform == "Darwin":
164+
to_exclude = EXCLUDE_MAC
165+
else:
166+
raise ValueError(f"Unexpected platform: {platform}")
167+
return current_projects.difference(to_exclude)
168+
169+
140170
def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set[str]:
141171
projects_to_test = set()
142172
for modified_project in modified_projects:
@@ -154,54 +184,52 @@ def _compute_projects_to_test(modified_projects: Set[str], platform: str) -> Set
154184
):
155185
continue
156186
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.")
187+
projects_to_test = _exclude_projects(projects_to_test, platform)
171188
return projects_to_test
172189

173190

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

177196

178197
def _compute_project_check_targets(projects_to_test: Set[str]) -> Set[str]:
179198
check_targets = set()
180199
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])
200+
if project_to_test in PROJECT_CHECK_TARGETS:
201+
check_targets.add(PROJECT_CHECK_TARGETS[project_to_test])
184202
return check_targets
185203

186204

187-
def _compute_runtimes_to_test(projects_to_test: Set[str]) -> Set[str]:
205+
def _compute_runtimes_to_test(modified_projects: Set[str], platform: str) -> Set[str]:
188206
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
207+
for modified_project in modified_projects:
208+
if modified_project in DEPENDENT_RUNTIMES_TO_TEST:
209+
runtimes_to_test.update(DEPENDENT_RUNTIMES_TO_TEST[modified_project])
210+
return _exclude_projects(runtimes_to_test, platform)
195211

196212

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
213+
def _compute_runtimes_to_test_needs_reconfig(
214+
modified_projects: Set[str], platform: str
215+
) -> Set[str]:
216+
runtimes_to_test = set()
217+
for modified_project in modified_projects:
218+
if modified_project in DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG:
219+
runtimes_to_test.update(
220+
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG[modified_project]
221+
)
222+
return _exclude_projects(runtimes_to_test, platform)
223+
224+
225+
def _compute_runtimes_to_build(
226+
runtimes_to_test: Set[str], modified_projects: Set[str], platform: str
227+
) -> Set[str]:
228+
runtimes_to_build = set(runtimes_to_test)
229+
for modified_project in modified_projects:
230+
if modified_project in DEPENDENT_RUNTIMES_TO_BUILD:
231+
runtimes_to_build.update(DEPENDENT_RUNTIMES_TO_BUILD[modified_project])
232+
return _exclude_projects(runtimes_to_build, platform)
205233

206234

207235
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
@@ -225,10 +253,19 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
225253
def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
226254
modified_projects = _get_modified_projects(modified_files)
227255
projects_to_test = _compute_projects_to_test(modified_projects, platform)
228-
projects_to_build = _compute_projects_to_build(projects_to_test)
256+
runtimes_to_test = _compute_runtimes_to_test(modified_projects, platform)
257+
runtimes_to_test_needs_reconfig = _compute_runtimes_to_test_needs_reconfig(
258+
modified_projects, platform
259+
)
260+
runtimes_to_build = _compute_runtimes_to_build(
261+
runtimes_to_test | runtimes_to_test_needs_reconfig, modified_projects, platform
262+
)
263+
projects_to_build = _compute_projects_to_build(projects_to_test, runtimes_to_build)
229264
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)
265+
runtimes_check_targets = _compute_project_check_targets(runtimes_to_test)
266+
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
267+
runtimes_to_test_needs_reconfig
268+
)
232269
# We use a semicolon to separate the projects/runtimes as they get passed
233270
# to the CMake invocation and thus we need to use the CMake list separator
234271
# (;). We use spaces to separate the check targets as they end up getting
@@ -238,6 +275,9 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
238275
"project_check_targets": " ".join(sorted(projects_check_targets)),
239276
"runtimes_to_build": ";".join(sorted(runtimes_to_build)),
240277
"runtimes_check_targets": " ".join(sorted(runtimes_check_targets)),
278+
"runtimes_check_targets_needs_reconfig": " ".join(
279+
sorted(runtimes_check_targets_needs_reconfig)
280+
),
241281
}
242282

243283

0 commit comments

Comments
 (0)