Skip to content

LDC 1.43.0-beta1

Pre-release
Pre-release

Choose a tag to compare

@kinke kinke released this 05 Aug 15:27
ace8aab

Big news

  • Frontend, druntime and Phobos are at version ~2.113.0, incl. new command-line option -foptimize-nothrow to restore the nothrow optimizations. (#5113, #5221, #5239)
    • -foptimize-nothrow is the default setting when targeting Windows or WebAssembly, to make hitting #3504 much less likely.
  • Support for LLVM 22. The prebuilt packages use v22.1.8. (#5097, #5102, #5172)
  • Minimum LLVM version raised to 18. (#5094)
  • DRuntime and Phobos now support WASI preview levels 1 and 2, based on wasi-libc. Two caveats being that WASI is strictly single-threaded (currently), and that fibers are unavailable. (#5186, #5229, #5230, #5242)
  • New prebuilt addon packages (ldc2-*-addon-<target OS>.tar.xz) for simple cross-compilation. Simply unpack them directly into your LDC installation directory, and then cross-compile via -mtriple=… (or dub --target=…): (#5240)
    • Windows: x86_64-windows-msvc, i686-windows-msvc; no SDK required.
    • Android: aarch64-linux-android30, armv7a-linux-androideabi29, x86_64-linux-android29, i686-linux-android29; needs an Android NDK (r27) and its toolchains/llvm/prebuilt/*/bin/ dir in your PATH.
    • WASI: wasm32-unknown-wasip1, wasm32-unknown-wasip2; needs a WASI SDK and its bin/ dir in your PATH. (#5207, #5242)
  • The @ldc.attributes.restrict UDA is now supported for dynamic-array parameters too. Builtin array ops (c[] = a[] * b[] etc.) use it, enabling auto-vectorization. Note that for such array ops, the dlang spec prescribes that the slice on the left and any slices on the right must not overlap (https://dlang.org/spec/arrays.html#array-operations), and this knowledge is now used by the optimizer; e.g., x[] *= x[] is invalid. (#5148, #5168, #5176)
  • DMD-style inline assembly: asm { naked; } is now much less of a special case wrt. codegen - such naked functions are now emitted as if asm { naked; } was replaced with the @naked function UDA. IR-wise, they are not emitted as module-level asm blobs anymore, but regular IR functions. This should lift a few former asm { naked; }-specific restrictions and fixed at least one LTO issue. (#5041)
  • dcompute: Added support for Native device code Embedding (PTX and SPIR-V) into the host executable's .rodata section. (#5140)
  • WebAssembly:
    • The default -fvisibility setting was changed to hidden, like clang, so that only explicit exported symbols are not hidden. And -L--export-dynamic isn't used by default for linking anymore either; add it manually to export all non-hidden symbols, as for normal Posix targets. The net effect is that the size of linked wasm binaries shrinks significantly by default. (#5216)
    • Exceptions are now supported. Currently, using D and C++ exceptions are mutually exclusive. If linking in DRuntime, you cannot link in C++ code relying on libunwind (exceptions), due to the hacks required to convince LLVM to use D's EH personality. A future LLVM release may help remove the constraint. (#5162)
    • In order to allow the GC to function correctly, a new pass is run after optimizations, to spill potential pointers onto the "stack". This pass is enabled by default for all Wasm targets, but can be disabled with -betterC or the new -disable-wasm-ptrs-spill. (#5178)
  • A new -fno-moduleinfo-localclasses switch has been added. This disables populating ModuleInfo.localClasses for each module. This can help eliminate/strip more dead-code (thus decreasing binary sizes), but breaks Object.factory and any other code relying on iterating over said localClasses. Enabled by default for Wasm targets. (#5224, #5231)
  • Predefined version LDC_LLVM_* now only contains the LLVM major version, i.e., former version (LDC_LLVM_1801) with LLVM v18.1 is now version (LDC_LLVM_18). Use ldc.intrinsics.LLVM_version for backwards compatibility if really needed. (#5109)

Platform support

  • Supports LLVM 18 - 22.
  • WebAssembly: extern(C) main is now mangled as __main_void or __main_argc_argv as appropriate, matching Clang behavior (#5186).

Bug fixes

  • Posix: Don't export non-class TypeInfos from binaries. (#5217)
  • Apple: Pre-define version(Apple) on iOS, tvOS, watchOS, and visionOS. (#5192, #5195)
  • Don't enable loop-vectorization by default with -Oz and -O1. (#5233, #5253)