https://github.com/bcardosolopes updated https://github.com/llvm/llvm-project/pull/232501
>From ba93c16f549415239eaee7e74118647985d63554 Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes <[email protected]> Date: Thu, 15 Oct 2026 14:30:35 -0700 Subject: [PATCH 1/2] [CIR] Refresh the ClangIR landing docs page Rewrite clang/docs/CIR/index.md as the project's front page: drop the stale upstreaming warning, keep the design-documents toctree, and add Using ClangIR, RFC, talks/posts, and History sections with content ported from the (now archived) incubator site. --- clang/docs/CIR/index.md | 87 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 8 deletions(-) diff --git a/clang/docs/CIR/index.md b/clang/docs/CIR/index.md index a418c4ae5caa91..d4dd3a28431829 100644 --- a/clang/docs/CIR/index.md +++ b/clang/docs/CIR/index.md @@ -1,14 +1,28 @@ # ClangIR -:::{warning} -The project of upstreaming ClangIR support from the incubator repository is -still in progress, and ClangIR is not included in a default clang build. The -documentation may be incomplete and out-of-date. -::: +ClangIR (CIR) is a high-level representation in Clang that reflects aspects +of the C/C++ languages and their extensions. It is implemented using MLIR and +occupies a position between Clang's AST and LLVM IR. -ClangIR is a high-level representation in Clang that reflects aspects of the -C/C++ languages and their extensions. It is implemented using MLIR and occupies -a position between Clang's AST and LLVM IR. +Follow and contribute to upstream development through the +[`ClangIR`-labeled issues and pull +requests](https://github.com/llvm/llvm-project/labels/ClangIR) on +llvm-project. See the [ClangIR Design +Documents](#clangir-design-documents) for in-depth coverage of CIR's design. + +## Using ClangIR + +ClangIR is an MLIR dialect tightly integrated with Clang: it lives in the +Clang project rather than as a standalone in-tree dialect. + +Pass `-fclangir` to the Clang driver to compile through CIR (AST to CIR to +CIR passes to LLVM IR and the backend). In order to inspect CIR output, use +`-emit-cir`, the equivalent of `-emit-llvm` for CIR. + +See this [Compiler Explorer +example](https://godbolt.org/z/dTGqMGx54), which shows the flow of compilation +through CIR, from higher-level CIR constructs to lower-level ones, the +pipeline viewer is convenient for following along. ## ClangIR Design Documents @@ -21,3 +35,60 @@ CleanupAndEHDesign CodeDuplication ``` +## RFCs + +- September 2026: [RFC: Enable ClangIR Build By + Default](https://discourse.llvm.org/t/rfc-enable-clangir-build-by-default/91730) +- June 2026: [\[RFC\]\[ClangIR\] Making CIR Pipeline Boundaries First-Class + Driver + Artifacts](https://discourse.llvm.org/t/rfc-clangir-making-cir-pipeline-boundaries-first-class-driver-artifacts/90998) +- January 2024: [RFC: Upstreaming + ClangIR](https://discourse.llvm.org/t/rfc-upstreaming-clangir/76587) +- June 2022: [RFC: An MLIR based Clang IR + (CIR)](https://discourse.llvm.org/t/rfc-an-mlir-based-clang-ir-cir/63319) + +## Talks and posts + +- Dec 2025: [GSoC 2025: ClangIR + upstreaming](https://blog.llvm.org/posts/2025-gsoc-clangir-upstreaming/) +- Oct 2025: US LLVM Developers Meeting (keynote). *ClangIR: Upstreaming an + Incubator Project*. + [video](https://www.youtube.com/watch?v=mQXE_y1T6H0), + [pdf](https://llvm.github.io/clangir/Files/2025_ClangIR_UpstreamingIncubator.pdf) +- Oct 2025: [A High-Level Overview of Address Spaces: Their Place in ClangIR + and + LLVM](https://dev.to/david_rivera_8d845b35931e/a-high-level-overview-of-address-spaces-their-place-in-clangir-5e0k) +- Jun 2025: Asia LLVM. *ClangIR's Footprint: A quick compile-time impact + report*. [video](https://www.youtube.com/watch?v=Dh_RObp5SUE), + [pdf](https://llvm.github.io/clangir/Files/asiallvm-brunolopes-25-cir-compile-time.pdf) +- Mar 2025: Cambridge Computer Science [Group + Projects](https://group-projects.cst.cam.ac.uk/#__tabbed_1_2). Award on + technical achievement. *[CUDA Support for + ClangIR](https://wiki.cam.ac.uk/cl-design-projects/CUDA_Support_for_ClangIR)*. + [video](https://www.youtube.com/watch?v=CO1w_L3yIbQ) +- Nov 2024: Supercomputing Workshop. *[Introducing ClangIR, High-Level IR for + the C/C++ Family of + Languages](https://sc24.supercomputing.org/proceedings/workshops/workshop_pages/misc312.html)*. + [pdf](https://llvm.github.io/clangir/Files/sc24-clangir.pdf) +- Sep 2024: [GSoC 2024: Compile GPU kernels using + ClangIR](https://blog.llvm.org/posts/2024-08-29-gsoc-opencl-c-support-for-clangir/) +- Sep 2024: [GSoC 2024: ABI Lowering in + ClangIR](https://blog.llvm.org/posts/2024-09-07-abi-lowering-in-clangir/) +- Oct 2023: US LLVM Developers Meeting. *Evolution of ClangIR: A Year of + Progress, Challenges, and Future Plans*. + [video](https://www.youtube.com/watch?v=XNOPO3ogdfQ), + [pdf](http://brunocardoso.cc/resources/2023-LLVMDevMtgClangIR.pdf) + +## History + +ClangIR [started](https://github.com/facebookarchive/clangir) in October 2021. +In June 2022, an +[RFC](https://discourse.llvm.org/t/rfc-an-mlir-based-clang-ir-cir/63319) +proposing to incorporate the project — then in very early stages — into +llvm-project led to ClangIR becoming part of the LLVM incubator, where +development happened for the following years. In January 2024, the +[upstreaming +RFC](https://discourse.llvm.org/t/rfc-upstreaming-clangir/76587) was accepted +as the graduation step from the [incubator](https://github.com/llvm/clangir) +(now archived), and ClangIR has been developed directly upstream ever since, +superseding the incubator in most functionality. >From b8b9e04779500fd15c2694599eeef7594d97d1e1 Mon Sep 17 00:00:00 2001 From: Bruno Cardoso Lopes <[email protected]> Date: Thu, 15 Oct 2026 15:48:51 -0700 Subject: [PATCH 2/2] [CIR] Note the default-build status on the landing page Address review feedback: keep a warning that ClangIR is not in default builds yet, and tell readers how to configure a CIR-enabled build until #221291 lands. --- clang/docs/CIR/index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/clang/docs/CIR/index.md b/clang/docs/CIR/index.md index d4dd3a28431829..a21fda5708aad5 100644 --- a/clang/docs/CIR/index.md +++ b/clang/docs/CIR/index.md @@ -1,5 +1,10 @@ # ClangIR +:::{warning} +ClangIR is not included in a default clang build yet. The documentation may +be incomplete and out-of-date. +::: + ClangIR (CIR) is a high-level representation in Clang that reflects aspects of the C/C++ languages and their extensions. It is implemented using MLIR and occupies a position between Clang's AST and LLVM IR. @@ -12,6 +17,13 @@ Documents](#clangir-design-documents) for in-depth coverage of CIR's design. ## Using ClangIR +:::{note} +Until [#221291](https://github.com/llvm/llvm-project/pull/221291) lands, you +need a build of Clang with CIR enabled. [Configure +LLVM](https://llvm.org/docs/CMake.html) with +`-DLLVM_ENABLE_PROJECTS="clang;mlir"` and `-DCLANG_ENABLE_CIR=ON`. +::: + ClangIR is an MLIR dialect tightly integrated with Clang: it lives in the Clang project rather than as a standalone in-tree dialect. _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
