LLVM developers are discussing enabling the build of ClangIR, a new intermediate representation for the Clang compiler, by default. While not enabling its *use* by default, the proposal aims to include ClangIR’s build process within the standard LLVM compilation.
ClangIR, which utilizes MLIR and operates at a higher level than LLVM IR, is designed to preserve more C/C++ source semantics. This preservation is intended to improve diagnostics, code analysis, and performance optimizations. Currently, ClangIR is upstreamed but not included in the default build configuration. Enabling its build would make MLIR a default dependency of Clang.
The primary concern with enabling the default build is a significant increase in compilation time. Estimates suggest build times could more than double. Other issues include the lack of a “Microsoft” target for Windows compatibility and increased duration for continuous integration (CI) testing. The current proposal focuses solely on building ClangIR by default, not on activating its usage, which requires the `-fclangir` compiler flag.
Despite these concerns, developers believe ClangIR offers benefits, including improved optimization and static analysis. The MLIR-based representation also opens possibilities for better GPU/device offload, specifically in lowering code to SPIR-V/Vulkan and supporting multi-device benefits. An LLVM Discourse thread and RFC pull request have been created to facilitate discussion on the proposal.
Read the original coverage
💬 Comments
📜 Comment Policy