Oh dear! Oh dear! LLVM 10.0 finally makes it

Oh dear! Oh dear! LLVM 10.0 finally makes it

The team behind compiler infrastructure project LLVM has made version 10.0 available – a good month later than anticipated, but better support for all sorts of architectures means it should have been well worth the wait.

Most enhancements can be found in the context of RISC-V and PowerPC targets. The latter for example comes with enabled vectorisation of math routines, improved register pressure estimates in the loop vectoriser, and a better cost model for the vectoriser. Meanwhile the team responsible for RISC-V has laid the groundwork for link-time optimisation and added support for The Machine Outlier and Scheduler, code lowering for half-precision floats, and a more efficient calling convention for calls to private leaf functions in the same IR module.

Speaking of IR, the project’s intermediate representation got a freeze instruction to stop IR-level propagation of undef and poison values. It also has been altered so that unnamed function arguments now get printed with their automatically generated name in definitions, meaning some front-end devs will have to update their tests. The LLVM team has prepared a script for that, though some manual work might still be necessary once it has been run.

Version 10 includes new matrix math intrinsics, advanced inter-procedural analysis and optimisation capabilities in the Attributor framework, and has MemorySSA as a loop dependency enabled to reap some compile and run time benefits.

Changes more specific to Windows targets include that the -cfguard option meant to help against memory corruption vulnerabilities now emits control flow guard checks on indirect function calls, and initial support for debugging Windows ARM binaries. Additional work to help with WebAssembly targets has led to LLVM now supporting thread-local storage, an atomic.fence instruction and multi-value function signatures in object files.

With the 10.0 announcement also comes version 10 of the Clang C/C++/Objective-C frontend. It is the first time Clang uses in-process compilation by default instead of going the subprocess route. The tool now also knows about concepts, an extension to templates which will be part of the next C++ standard, which can be used by setting the -std=c++2a flag. 

Other than that Clang has been fitted with implementations for new OpenMP 5.0 features, better support for the octeon MIPS-family CPU, and a better way to handle types with bit widths smaller than int. The undefined behaviour sanitiser fsanitize=pointer-overflow has been extended to catch some special cases, while -flax-vector-conversion now forbids implicit vector bitcasts between integer vectors and their floating point equivalents to match GCC’s behaviour more closely.

Newly deprecated compiler flags, which will be removed in a future Clang version but are just ignored for now, are -mmpx, -mno-mpx, and -fconcepts-ts. The latter was only used to enable the C++ concepts support which is now part of the -std=c++2a flag already mentioned. A complete list of changes in the current Clang release can be found in the project documentation.