Release of the LLVM 12.0 compiler suite

After six months of development, the release of the LLVM 12.0 project is presented - a GCC-compatible toolkit (compilers, optimizers and code generators) that compiles programs into an intermediate bitcode of RISC-like virtual instructions (a low-level virtual machine with a multi-level optimization system). The generated pseudo-code can be converted by the JIT compiler into machine instructions right at the time of program execution.

Improvements in Clang 12.0:

  • Support is implemented and enabled by default for the "likely" and "unlikely" attributes proposed in the C++20 standard, which allow informing the optimizer about the probability of triggering a conditional construct (for example, "[[likely]] if (random > 0) {").
  • Added support for AMD Zen 3 (-march=znver3), Intel Alder Lake (-march=alderlake), and Intel Sapphire Rapids (-march=sapphirerapids) processors.
  • Added support for "-march=x86-64-v[234]" flags to select x86-64 architecture levels (v2 - covers SSE4.2, SSSE3, POPCNT and CMPXCHG16B extensions; v3 - AVX2 and MOVBE; v4 - AVX-512) .
  • Added support for Arm Cortex-A78C (cortex-a78c), Arm Cortex-R82 (cortex-r82), Arm Neoverse V1 (neoverse-v1), Arm Neoverse N2 (neoverse-n2), and Fujitsu A64FX (a64fx) processors. For example, to enable Neoverse-V1 CPU optimizations, you can specify "-mcpu=neoverse-v1".
  • For the AArch64 architecture, new compiler flags "-moutline-atomics" and "-mno-outline-atomics" have been added to enable and disable auxiliary functions with the implementation of atomic operations, such as "__aarch64_cas8_relax". Such functions at runtime determine if LSE (Large System Extensions) are supported and use provided atomic processor instructions or fallback to use LL/SC (Load-link/store-conditional) instructions for synchronization.
  • Added "-fbinutils-version" option to select the target version of the binutils suite to ensure compatibility with old linker and assembler behavior.
  • For ELF executable files, when the "-gz" flag is specified, compression of debug information using the zlib library (gz=zlib) is enabled by default. Linking the resulting object files requires lld or GNU binutils 2.26+. To restore compatibility with older versions of binutils, "-gz=zlib-gnu" can be specified.
  • The 'this' pointer is now handled with nonnull and dereferenceable(N) checks. To remove the nonnull attribute, if null values ​​are required, the "-fdelete-null-pointer-checks" option can be used.
  • On the Linux platform for the AArch64 and PowerPC architectures, the "-fasynchronous-unwind-tables" mode is enabled to generate "unwind" call tables, as in GCC.
  • In "#pragma clang loop vectorize_width" added the ability to specify the options "fixed" (default) and "scalable" to select the vectorization method. The "scalable" mode, independent of vector length, is experimental and can be used on hardware that supports scalable vectorization.
  • Improved support for the Windows platform: Official binary builds for Windows on Arm64 systems have been prepared, including the Clang compiler, the LLD linker, and the compiler-rt runtime libraries. Added the .exe suffix when building for MinGW target platforms, even when cross-compiling.
  • Expanded capabilities related to support for OpenCL, OpenMP and CUDA. Added "-cl-std=CL3.0" and "-cl-std=CL1.0" options to select macro options for OpenCL 3.0 and OpenCL 1.0. Enhanced diagnostic tools.
  • Added support for the HRESET, UINTR, and AVXVNNI instructions implemented in some x86-based processors.
  • On x86 systems, support for the "-mtune=" option is enabled. ", which activates the selected microarchitectural optimizations, regardless of the value of "-march= ".
  • The static analyzer has improved the processing of some POSIX functions and significantly improved the determination of the result of conditional operations when there are several character values ​​in the comparison. New checks have been added: fuchia.HandleChecker (defines handles in structures), webkit.UncountedLambdaCapturesChecker webkit and alpha.webkit.UncountedLocalVarsChecker (take into account the peculiarities of working with pointers in the WebKit engine code).
  • In expressions used in constant contexts, the built-in functions __builtin_bitreverse*, __builtin_rotateleft*, __builtin_rotateright*, _mm_popcnt*, _bit_scan_forward, __bsfd, __bsfq, __bit_scan_reverse, __bsrd, __bsrq, __bswap, __bswapd, __bswap64, __bs are allowed wapq, _castf*, __rol* and __ror*.
  • Added option BitFieldColonSpacing to the clang-format utility to select spacing around identifiers, columns, and field definitions.
  • In the clangd (Clang Server) caching server on the Linux platform, memory consumption during long-term operation has been significantly reduced (malloc_trim is periodically called to return free memory pages to the operating system).

Key innovations in LLVM 12.0:

  • Support for the llvm-build build toolkit written in Python has been discontinued, instead of which the project has completely switched to using the CMake build system.
  • Support for the Windows platform has been improved in the backend for the AArch64 architecture: correct generation of assembler output for target Windows systems has been ensured, the generation of data on unwind calls has been optimized (the size of such data has been reduced by 60%), the ability to create unwind data using assembler .seh_* directives.
  • The backend for the PowerPC architecture has new optimizations for loops and inline deployments, extended support for Power10 processors, added support for MMA instructions for matrix manipulation, and improved support for the AIX operating system.
  • Support for AMD Zen 86, Intel Alder Lake, and Intel Sapphire Rapids processors, as well as HRESET, UINTR, and AVXVNNI processor instructions, has been added to the x3 backend. Support for MPX (Memory Protection Extensions) extensions for checking pointers for compliance with the boundaries of memory areas has been discontinued (the specified technology has not gained distribution and has already been removed from GCC and clang). Support for {disp32} and {disp8} prefixes and .d32 and .d8 suffixes has been added to the assembler to control operand and jump offset sizes. A new "tune-cpu" attribute has been added to control whether microarchitecture optimizations are enabled.
  • A new mode "-fsanitize=unsigned-shift-base" has been added to the integer sanitizer (integer sanitizer, "-fsanitize=integer") to detect overflows of unsigned integers after a left bit shift.
  • Various detectors (asan, cfi, lsan, msan, tsan, ubsan sanitizer) now support Linux distributions with the Musl standard library.
  • Extended capabilities of the LLD linker. Improved ELF format support, including adding "--dependency-file", "--error-handling-script", "--lto-pseudo-probe-for-profiling", "--no-lto-whole-program-visibility" options ". Improved MinGW support. For Mach-O (macOS), support for arm64, arm, and i386 architectures, link-in-time (LTO) optimizations, and stack unwinding in exception handling is implemented.
  • Libc++ implements new features of the C++20 standard and begins development on features of the C++2b specification. Added support for assembly with localization support disabled ("-DLIBCXX_ENABLE_LOCALIZATION=OFF") and devices for generating pseudo-random numbers ("-DLIBCXX_ENABLE_RANDOM_DEVICE=OFF").

Source: opennet.ru

Add a comment