Hi all-
As many of you know, a large number of folks have been working on ClangIR implementation over the last few years. More recently, this effort has been upstreamed and expanded (to the point that the Incubator was closed about 6 months ago) and has now hit a maturity point where we believe that it would be valuable to have this functionality by default.
The flag -DCLANG_ENABLE_CIR=Off is/would still be available for folks who wish to disable this.
Consequences of this:
1- MLIR is now brought in by default as a Clang dependency. This will increase the build time of the entire compiler by roughly 1/3 based on my non-scientific estimates.
2- Buildbots/runs of check-clang will now include CIR tests by default, including Continuous Integration. This would mean that committing a patch that breaks CIR would require ‘fixing’ ClangIR tests. The ClangIR maintainer team (myself, @bcardosolopes and @andykaylor amongst others) will definitely commit to help folks fix these tests, even if it includes providing a diff to fix it for them. This is actually a fairly rare situation, over the last few years we’ve only had changes break our tests ~12 times.
3- This does NOT change the default codegen behavior. ALL builds, unless specified with -fclangir
4- Until now, ClangIR hasn’t put anything in the release notes. This would require new patches to ClangIR to be in the release notes starting with the next release.
Why we think we’re ready:
ClangIR has hit a maturity point where we believe this is beneficial to the project as a whole, as a future direction, but also to the ClangIR project.
We believe it is sufficiently mature because:
1- Clang with -fclangir can successfully pass >98% of the SingleSource test suite, a number we expect to hit 100% in the very near future.
2- Clang with -fclangir can successfully pass 100% of the MultiSource test suite.
3- While a -fclangir stage2 build only gets through ~30% of a ninja build, we believe that there are only a small handful of issues with our ABI handling that will likely be fixed by the time this RFC would be approved, and will get us to a 100% self-build.
4- The libcxx test suite is now up over a 98% success rate with a -fclangir compiler.
5- Internal testing has shown that the Perennial Test Suite passes all suites at near parity (99%+) of the compiler without fclangir. Plum Hall testing is also roughly the same.
AS further background/success numbers, check out our August 2026 Progress Report:
In that build, self-hosting without counting Ninja dependencies shows a >99% self-hosting success rate, and most of SPEC2017. Note that most of the top items on that list have since been fixed, so those numbers are much improved, even from last week!
Why now?
More, “why in the next few months” at least, based on the RFC process ![]()
1- We believe ClangIR has hit a point where it is actually USEFUL for many work loads. Enabling it by default would result in folks who use release binaries in some way to have a chance to try ClangIR out and give us feedback for future development!
2- ClangIR is starting to develop some optimization passes that have shown SIGNIFICANT improvements in certain workloads, despite being fairly ‘trivial’ to implement. We think that enabling this by default will encourage others to start contributing beneficial C/C++ optimizations to the compiler.
3- ClangIR provides an opportunity for Static Analysis in a way that Clang has not yet benefited from. We believe that enabling it by default will result in greater contributions from developers who wish to improve/implement these.
4- A few different contributing companies have shown interest in having ClangIR in their downstream projects. While they could enable it explicitly, we believe that this shows a general appetite
5- While the breakages have been rare, some have been quite painful, and we hope to get more notice/notification before it breaks all of our builds.
What about enabling fclangir by default?
This is very much NOT proposed for good reason: while ClangIR is quite mature as far as the amount of code it can successfully translate, it is missing quite a few important features (Modules, Debug Info, sanitizers, non-x86-target support, etc). While this is work we intend to progress on, we do not believe that ClangIR is nearly ready to be enabled by default in builds.
**ASSOCIATED PATCH: **