LLVM Developers Discuss Enabling ClangIR Build By Default

Written by Michael Larabel in LLVM on 6 September 2026 at 06:43 AM EDT. 3 Comments
LLVM
ClangIR has been in development for a number of years now as a new intermediate representation for the Clang compiler. ClangIR makes use of MLIR and is higher-level than LLVM IR. With ClangIR able to preserve more C/C++ source semantics, its usage can lead to better diagnostics, code/static analysis, and more performance optimizations compared to everything lowered straight away from AST to LLVM IR. While not enabling its usage by default, LLVM stakeholders are discussing at least now building it by default.

There is now an LLVM Discourse thread to discuss the pros and cons of enabling ClangIR building by default. There is also this RFC pull request that would enable its building by default in the LLVM source tree when compiling Clang. ClangIR is already upstreamed but has refrained from being part of the default build configuration.

ClangIR build by default PR


In building ClangIR, MLIR in turn becomes a default Clang dependency. On the downside is that ClangIR+MLIR by default will significantly increase the build time of compiling Clang itself. Some estimates put the build times more than doubling. ClangIR also lacks a "Microsoft" target for targeting Windows, continuous integration (CI) testing will also be longer due to ClangIR testing, and other related concerns.

Again, this current proposal is just about building ClangIR by default with Clang but not using it by default and in turn no code generation changes by default. On capable builds, the -fclangir compiler flag is needed for enabling ClangIR usage. In addition to the greater optimizations and static analysis and diagnostics benefits of ClangIR,the MLIR-based ClangIR does open up more doors moving forward for GPU/device offload with better lowering of code to SPIR-V/Vulkan and similar MLIR multi-device benefits. We'll see what comes of this discussion for building it by default.
Related News
About The Author

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week