[clang] [CIR] Minimize dependencies of check-clang-cir (PR #227957)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 11:50:55 PDT 2026


================
@@ -238,11 +238,54 @@ add_lit_testsuite(check-clang "Running the Clang regression tests"
   ARGS ${CLANG_TEST_EXTRA_ARGS}
   )
 
+# Skip CIR here. check-clang above still runs these tests. The check-clang-cir
+# target is created explicitly below so that it (and its subdirectory-based
+# sub-targets) depend only on the tools those tests invoke and the tools
+# required to load clang/test/lit.cfg.py.
 add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
   DEPENDS ${CLANG_TEST_DEPS}
   FOLDER "Clang tests/Suites"
+  SKIP "^CIR"
 )
 
+# These tools are resolved while loading clang/test/lit.cfg.py, or invoked
+# directly by tests under clang/test/CIR.
+set(CLANG_CIR_TEST_DEPS
+  clang
+  )
+if(CLANG_ENABLE_CIR)
+  list(APPEND CLANG_CIR_TEST_DEPS
+    cir-opt
+    cir-translate
+    )
+endif()
+if(NOT CLANG_BUILT_STANDALONE)
+  list(APPEND CLANG_CIR_TEST_DEPS
+    FileCheck
+    count
+    llvm-config
+    llvm-dis
+    llvm-objdump
+    not
+    opt
+    split-file
+    )
+endif()
+
+# add_lit_testsuites creates no targets when LLVM_ENABLE_IDE is on.
+if(NOT LLVM_ENABLE_IDE)
----------------
andykaylor wrote:

Before this change, the extra targets for test subdirectories were added via `add_lit_testsuites` and that function does nothing if `LLVM_ENABLE_IDE` is set (the check is inside the function), so there would have been no `check-clang-cir` target.

https://github.com/llvm/llvm-project/pull/227957


More information about the cfe-commits mailing list