aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.ci/compute_projects.py19
-rw-r--r--.ci/compute_projects_test.py34
-rwxr-xr-x.ci/monolithic-linux.sh2
-rw-r--r--.github/workflows/premerge.yaml2
4 files changed, 55 insertions, 2 deletions
diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index c3cf714..8e25fd6 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -19,6 +19,7 @@ import sys
PROJECT_DEPENDENCIES = {
"llvm": set(),
"clang": {"llvm"},
+ "CIR": {"clang", "mlir"},
"bolt": {"clang", "lld", "llvm"},
"clang-tools-extra": {"clang", "llvm"},
"compiler-rt": {"clang", "lld"},
@@ -55,6 +56,7 @@ DEPENDENTS_TO_TEST = {
".ci": {
"llvm",
"clang",
+ "CIR",
"lld",
"lldb",
"bolt",
@@ -128,6 +130,7 @@ PROJECT_CHECK_TARGETS = {
"lldb": "check-lldb",
"llvm": "check-llvm",
"clang": "check-clang",
+ "CIR": "check-clang-cir",
"bolt": "check-bolt",
"lld": "check-lld",
"flang": "check-flang",
@@ -247,6 +250,14 @@ def _get_modified_projects(modified_files: list[str]) -> Set[str]:
# capacity.
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
continue
+ # If the file is in the clang/lib/CIR directory, add the CIR project.
+ if len(path_parts) > 3 and (
+ path_parts[:3] == ("clang", "lib", "CIR")
+ or path_parts[:3] == ("clang", "test", "CIR")
+ or path_parts[:4] == ("clang", "include", "clang", "CIR")
+ ):
+ modified_projects.add("CIR")
+ # Fall through to add clang.
modified_projects.add(pathlib.Path(modified_file).parts[0])
return modified_projects
@@ -267,6 +278,13 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
runtimes_to_test_needs_reconfig
)
+
+ # CIR is used as a pseudo-project in this script. It is built as part of the
+ # clang build, but it requires an explicit option to enable. We set that
+ # option here, and remove it from the projects_to_build list.
+ enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
+ projects_to_build.discard("CIR")
+
# We use a semicolon to separate the projects/runtimes as they get passed
# to the CMake invocation and thus we need to use the CMake list separator
# (;). 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]:
"runtimes_check_targets_needs_reconfig": " ".join(
sorted(runtimes_check_targets_needs_reconfig)
),
+ "enable_cir": enable_cir,
}
diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py
index 6299931..732514c 100644
--- a/.ci/compute_projects_test.py
+++ b/.ci/compute_projects_test.py
@@ -104,6 +104,10 @@ class TestComputeProjects(unittest.TestCase):
env_variables["runtimes_check_targets_needs_reconfig"],
"check-cxx check-cxxabi check-unwind",
)
+ self.assertEqual(
+ env_variables["enable_cir"],
+ "OFF",
+ )
def test_clang_windows(self):
env_variables = compute_projects.get_env_variables(
@@ -126,6 +130,32 @@ class TestComputeProjects(unittest.TestCase):
env_variables["runtimes_check_targets_needs_reconfig"],
"check-cxx check-cxxabi check-unwind",
)
+ self.assertEqual(env_variables["enable_cir"], "OFF")
+
+ def test_cir(self):
+ env_variables = compute_projects.get_env_variables(
+ ["clang/lib/CIR/CMakeLists.txt"], "Linux"
+ )
+ self.assertEqual(
+ env_variables["projects_to_build"],
+ "clang;clang-tools-extra;lld;llvm;mlir",
+ )
+ self.assertEqual(
+ env_variables["project_check_targets"],
+ "check-clang check-clang-cir check-clang-tools",
+ )
+ self.assertEqual(
+ env_variables["runtimes_to_build"], "compiler-rt;libcxx;libcxxabi;libunwind"
+ )
+ self.assertEqual(
+ env_variables["runtimes_check_targets"],
+ "check-compiler-rt",
+ )
+ self.assertEqual(
+ env_variables["runtimes_check_targets_needs_reconfig"],
+ "check-cxx check-cxxabi check-unwind",
+ )
+ self.assertEqual(env_variables["enable_cir"], "ON")
def test_bolt(self):
env_variables = compute_projects.get_env_variables(
@@ -158,6 +188,7 @@ class TestComputeProjects(unittest.TestCase):
self.assertEqual(env_variables["runtimes_to_build"], "")
self.assertEqual(env_variables["runtimes_check_targets"], "")
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
+ self.assertEqual(env_variables["enable_cir"], "OFF")
def test_flang(self):
env_variables = compute_projects.get_env_variables(
@@ -168,6 +199,7 @@ class TestComputeProjects(unittest.TestCase):
self.assertEqual(env_variables["runtimes_to_build"], "")
self.assertEqual(env_variables["runtimes_check_targets"], "")
self.assertEqual(env_variables["runtimes_check_targets_needs_reconfig"], "")
+ self.assertEqual(env_variables["enable_cir"], "OFF")
def test_invalid_subproject(self):
env_variables = compute_projects.get_env_variables(
@@ -237,7 +269,7 @@ class TestComputeProjects(unittest.TestCase):
)
self.assertEqual(
env_variables["project_check_targets"],
- "check-bolt check-clang check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
+ "check-bolt check-clang check-clang-cir check-clang-tools check-flang check-lld check-lldb check-llvm check-mlir check-polly",
)
self.assertEqual(
env_variables["runtimes_to_build"],
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index d9f51ba..6db24d8 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -48,6 +48,7 @@ targets="${2}"
runtimes="${3}"
runtime_targets="${4}"
runtime_targets_needs_reconfig="${5}"
+enable_cir="${6}"
lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-output-file-name --timeout=1200 --time-tests"
@@ -67,6 +68,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-G Ninja \
-D CMAKE_PREFIX_PATH="${HOME}/.local" \
-D CMAKE_BUILD_TYPE=Release \
+ -D CLANG_ENABLE_CIR=${enable_cir} \
-D LLVM_ENABLE_ASSERTIONS=ON \
-D LLVM_BUILD_EXAMPLES=ON \
-D COMPILER_RT_BUILD_LIBFUZZER=OFF \
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 7b5ecd6..73943bc 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -62,7 +62,7 @@ jobs:
export CC=/opt/llvm/bin/clang
export CXX=/opt/llvm/bin/clang++
- ./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}"
+ ./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}"
- name: Upload Artifacts
if: '!cancelled()'
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0