Skip to content

Commit 6d90496

Browse files
author
git apple-llvm automerger
committed
Merge commit 'afff28e4cb4b' from llvm.org/main into next
2 parents c8c97ce + afff28e commit 6d90496

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

.ci/compute_projects.py

Lines changed: 19 additions & 0 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",
@@ -247,6 +250,14 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
247250
# capacity.
248251
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
249252
continue
253+
# If the file is in the clang/lib/CIR directory, add the CIR project.
254+
if len(path_parts) > 3 and (
255+
path_parts[:3] == ("clang", "lib", "CIR")
256+
or path_parts[:3] == ("clang", "test", "CIR")
257+
or path_parts[:4] == ("clang", "include", "clang", "CIR")
258+
):
259+
modified_projects.add("CIR")
260+
# Fall through to add clang.
250261
modified_projects.add(pathlib.Path(modified_file).parts[0])
251262
return modified_projects
252263

@@ -267,6 +278,13 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
267278
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
268279
runtimes_to_test_needs_reconfig
269280
)
281+
282+
# CIR is used as a pseudo-project in this script. It is built as part of the
283+
# clang build, but it requires an explicit option to enable. We set that
284+
# option here, and remove it from the projects_to_build list.
285+
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
286+
projects_to_build.discard("CIR")
287+
270288
# We use a semicolon to separate the projects/runtimes as they get passed
271289
# to the CMake invocation and thus we need to use the CMake list separator
272290
# (;). We use spaces to separate the check targets as they end up getting
@@ -279,6 +297,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
279297
"runtimes_check_targets_needs_reconfig": " ".join(
280298
sorted(runtimes_check_targets_needs_reconfig)
281299
),
300+
"enable_cir": enable_cir,
282301
}
283302

284303

.ci/compute_projects_test.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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,6 +199,7 @@ 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(
@@ -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"],

.ci/monolithic-linux.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ targets="${2}"
4848
runtimes="${3}"
4949
runtime_targets="${4}"
5050
runtime_targets_needs_reconfig="${5}"
51+
enable_cir="${6}"
5152

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

@@ -67,6 +68,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
6768
-G Ninja \
6869
-D CMAKE_PREFIX_PATH="${HOME}/.local" \
6970
-D CMAKE_BUILD_TYPE=Release \
71+
-D CLANG_ENABLE_CIR=${enable_cir} \
7072
-D LLVM_ENABLE_ASSERTIONS=ON \
7173
-D LLVM_BUILD_EXAMPLES=ON \
7274
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \

.github/workflows/premerge.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
export CC=/opt/llvm/bin/clang
6363
export CXX=/opt/llvm/bin/clang++
6464
65-
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}"
65+
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}"
6666
- name: Upload Artifacts
6767
if: '!cancelled()'
6868
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0

0 commit comments

Comments
 (0)