3 min read

LLVM is a collection of tools used to develop compiler front ends and back ends. LLVM 7.0.0 has now been released with new tools and features such as performance measurement, optimization and others.

The Windows installer in LLVM 7.0.0 no longer includes a Visual Studio integration. Now, there is a new LLVM Compiler Toolchain Visual Studio extension on the Visual Studio Marketplace. This new integration method supports Visual Studio 2017.

The libraries are renamed from 7.0 to 7. Note that this change also impacts downstream libraries like lldb. The LoopInstSimplify pass (-loop-instsimplify) is removed in this release. When using Windows x or w IR mangling schemes, symbols starting with ? are no longer mangled by LLVM.

A new tool called llvm-exegesis has been added. This new tool automatically measures instruction scheduling properties and provides a principled way to edit scheduling models. Another new tool llvm-mca is a static performance analysis tool that uses information to statically predict the performance of machine code for a specific CPU.


The optimization of floating-point casts is also improved. It provides optimized results for code that relies on the undefined behavior of overflowing casts.

The optimization feature is on by default and can be disabled by specifying a function attribute:

"strict-float-cast-overflow"="false"

This attribute can be created by the clang option -fno-strict-float-cast-overflow. To detect affected patterns code sanitizers can be used. The clang option for detecting only this problem alone is -fsanitize=float-cast-overflow. A demonstration is as follows:

int main() {
 float x = 4294967296.0f;
 x = (float)((int)x);
 printf("junk in the ftrunc: %f\n", x);
 return 0;
}

And the clang options is run:

clang -O1 ftrunc.c -fsanitize=float-cast-overflow ; ./a.out
ftrunc.c:5:15: runtime error: 4.29497e+09 is outside the range of representable values of type 'int'
junk in the ftrunc: 0.000000

LLVM_ON_WIN32 is no longer set by files in llvm/Config/config.h and llvm/Config/llvm-config.h. If you have used this macro before, now use the compiler-set _WIN32 instead, which is set exactly when LLVM_ON_WIN32 used to be set.

The DEBUG macro has been renamed to LLVM_DEBUG, but the interface remains the same. SmallVector is shrunk from sizeof(void*) * 4 + sizeof(T) to sizeof(void*) + sizeof(unsigned) * 2. It is smaller than std::vector on 64-bit platforms. The maximum capacity for it is now restricted to UINT32_MAX.

Experimental support is added for DWARF v5 debugging. This includes the new .debug_names accelerator table. The opt tool supports the -load-pass-plugin option to load pass plugins for the new PassManager. Support is added for profiling JIT-ed code with perf.

In LLVM 7.0.0 support for the .rva assembler directive for COFF targets is added. For Windows, the llvm-rc tool has also received minor upgrades. There are still some known missing features but it should be usable in most cases. On request, CodeView debug info can now be emitted for MinGW configurations.

There are also changes to variety of targets like AArch64 Target, ARM, x86 among others.

For a complete list of updates, visit the LLVM website.

Read next

JUnit 5.3 brings console output capture, assertThrow enhancements and parallel test execution

Mastodon 2.5 released with UI, administration, and deployment changes

ReSharper 18.2 brings performance improvements, C# 7.3, Blazor support and spellcheck