After six months of development presented project release LLVM 18.1.0 – GCC-compatible tools (compilers, optimizers and code generators), compiling programs into intermediate bitcode of RISC-like virtual instructions (low-level virtual machine with a multi-level optimization system). The generated pseudocode can be converted using a JIT compiler into machine instructions directly at the time of program execution.
Starting with the 18.x branch, the project switched to a new scheme for generating version numbers. Similar to the GCC and GDB projects, the zero release (“N.0”) is now used during development, and the first stable version is numbered “N.1”. The change allows you to separate builds based on the mainline branch from the builds of the final release branch. For example, in preparation for the current release, development was carried out using the unstable branch of LLVM 18.0, and the first stable release was released under the number 18.1.0. In the future, if necessary, corrective releases can be generated every two weeks under numbers 18.1.1, 18.1.2, etc. If changes are made to the current branch that violate the ABI, the update will be generated with a change in the second digit of the version (i.e. 18.2.0).
Basic improvements in Clang 18:
- Changes related to C language:
- Structures, unions and arrays with the “const” attribute, by analogy with GCC, can now be used as constant expressions.
- Enums are now reflected in TBAA (Type Based Alias Analysis) metadata as their original integer type, instead of being treated as a “char” type.
- Added support for the “counted_by” attribute, through which you can specify a field in a structure with flexible array, which determines the number of elements in the flexible array. The attribute can be used in clang to improve the efficiency of buffer overflow checks.
- Features defined in the future C standard C23:
- Added support for the “-std=c23” and “-std=gnu23” flags, as well as the “202311L” value for the “__STDC_VERSION__” macro defining the C23 standard and GNU C23 extensions.
- Added support for the “requires c23” expression to bind modules to support the C23 standard.
- Support implemented type inference when defining objects, which allows you to use the “auto” attribute instead of type to determine the type of variables based on the type of expression for their initialization. For example: “auto y = cos(x);”.
- Added support for the header file ‹stdckdint.h› with macros for checking integer calculations.
- Allowed placing labels anywhere within compound expressions.
- No support in code when compiling in C23 mode trigraphs, sequences of three ASCII characters treated as one character, for example, the sequence “??=” could be used instead of “#”. After the advent of Unicode, support for trigraphs became meaningless.
- Features related to the C++20 standard: Experimental implemented opportunity using additional types of arguments that are not types in templates, for example, specifying floating point values, pointers, and references to subobjects is allowed.
- Features associated with the standard C++23: Added experimental support for the “Deducing this“, which allows you to use parameters with the “this” attribute in the template and makes it possible to find out from the class function the category of the expression (for example, whether it is a constant) for which this function is called.
- Features associated with the future C++2c (C++26) standard:
- Added opportunity using multiple placeholder variables named “_” in one scope, for example, is now a valid construct:
struct S { int _, _; }; void func() { int _, _; } void other() { int _; // ранее выводилось предупреждение в режиме -Wunused } - Provided the ability to use string literals in a context in which they are not used to initialize a character array and do not end up in the resulting code, but are used only at compile time for diagnostic messages and preprocessing, for example, as parameters of directives and attributes _Pragma, asm, extern, static_assert , ((deprecated)) and ((nodiscard)).
- Translated Deprecated: performing implicit conversions of enumerated values in arithmetic calculations.
int main() { enum E1 { e }; enum E2 { f }; bool b = e <= 3.7; // устарело int k = f - e; // устарело int x = +f - e; // OK } - Implemented specificationwhich defines the capabilities associated with initializing template parameters.
- Added opportunity using multiple placeholder variables named “_” in one scope, for example, is now a valid construct:
- Added built-in function “__builtin_vectorelements()” to determine the number of elements in a vector.
- Added keyword “__datasizeof”, which differs from “sizeof” in that it returns the size of the type without taking into account tail padding.
- Added new compiler flags:
- “-fverify-intermediate-code” to verify the generated LLVM IR;
- “-fkeep-system-includes” to change the behavior of the “-E” option;
- “-fassume-nothrow-exception-dtor” to reduce the size of exception handlers by simplifying the logic for processing destructors;
- “-fopenacc” to support OpenACC in Clang;
- “-fcx-limited-range” and “-fcx-fortran-rules” to enable simple formulas for multiplying and dividing complex numbers that do not check the result for NaN and use the Smith algorithm;
- “-fvisibility-global-new-delete=‹force-hidden|force-protected| force-default|source›” to control how and when to make replacement new and delete declarations visible;
- “-fdefine-target-os-macros” to control the provision of definitions for the TARGET_OS_* macro list.
- Added new attributes: “((clang::preferred_type(type-name)))”, “((clang::coro_only_destroy_when_complete))”, “((clang::coro_return_type))”, “((clang::coro_wrapper) )”, “((clang::code_align(N)))” and “((clang::coro_lifetimebound))”.
- Diagnostic and static analysis tools have been significantly expanded, and new checks have been added.
Key innovations in LLVM 18.0:
- The X86 backend has added support for instruction set architecture (ISA) extensions: USER_MSR, VX10.1-256 and AVX10.1-512. The i128 type is unified with the __int128 type from GCC and clang, which allows for increased binary compatibility with external projects such as Rust.
- In the backend for the RISC-V architecture, support for the Zicond, Zfa, Zihintntl, Zvbb, Zvbc, Zvkb, Zvkg, Zvkn, Zvknc, Zvkned, Zvkng, Zvknha, Zvknhb, Zvks, Zvksc, Zvksed, Zvksg, Zvksh and Zvkt extensions has been stabilized. Added built-in functions for Zk*, Zbb and Zbc extensions. Added experimental support for code generation for the RV32E, RV64E, ilp32e and lp64e architectures. Support for Ziccif, Ziccrse, Ziccamoa, Zicclsm, Za64rs, Za128rs, Zic64b and Smepmp extensions has been implemented.
- Built-in functions (Intrinsics) for the LSX (128-bits SIMD) and LASX (256-bits SIMD) extensions have been added to the backend for the LoongArch architecture. Added support for new instructions introduced in the LoongArch Reference Manual 1.10 specification. Added initial support for automatic vectorization. Improved code generation.
- Support for Cortex-A520, Cortex-A720 and Cortex-X4 processors has been added to the backend for the AArch64 architecture. Implemented assembler and disassembler support for architecture extensions proposed in 2023. Added support for the Stack Clash Protection mechanism, which allows you to detect stack overflows and block attack methods based on the intersection of the stack and the heap.
- Support for the Cortex-M52 processor has been added to the backend for the ARM architecture and the ability to work in execution-only mode for the Armv6-M architecture has been provided.
- Improved backends for WebAssembly, MIPS, PowerPC, AMDGPU architectures.
- Expanded LLD linker capabilities. Added support for FatLTO objects. Improved support for RISC-V and AArch64 architectures.
- In the Libc++ library continued implementation of the capabilities of the C++20, C++23 and C++26 standards.
- The LLDB debugger has added support for automatically extracting symbols and binary data from external servers that support the DEBUFINFOD protocol. Support for the AArch64 architecture has been expanded and the ability to debug SME and SME2 (Scalable Matrix Extension) extensions has been added.
- Removed bindings for the Python language.
Thanks for reading: