Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/supported_llvm_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
fail-fast: false
matrix:
include:
- job_name: Ubuntu 24.04, LLVM 21, latest LDC beta
os: ubuntu-24.04
host_dc: ldc-beta
llvm_version: 21
cmake_flags: -DCMAKE_EXE_LINKER_FLAGS=-lcurl # work around libcurl dependency for ldc-profdata (LLVM apparently built with non-default LLVM_ENABLE_CURL=ON)
- job_name: Ubuntu 24.04, LLVM 19, latest LDC beta
os: ubuntu-24.04
host_dc: ldc-beta
Expand Down Expand Up @@ -74,7 +79,14 @@ jobs:
run: |
set -eux
sudo apt-get update
sudo apt-get install gdb lld-${{ matrix.llvm_version }} llvm-${{ matrix.llvm_version }}-dev libclang-common-${{ matrix.llvm_version }}-dev
version='${{ matrix.llvm_version }}'
if [[ "$version" -eq 21 ]]; then
curl -fL --retry 3 --max-time 30 -O https://apt.llvm.org/llvm.sh
sudo bash llvm.sh "$version"
sudo apt-get install gdb libcurl4-openssl-dev
else
sudo apt-get install gdb lld-${{ matrix.llvm_version }} llvm-${{ matrix.llvm_version }}-dev libclang-common-${{ matrix.llvm_version }}-dev
fi

- name: 'macOS: Install a more recent GNU make'
if: runner.os == 'macOS'
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#### Big news
- Frontend, druntime and Phobos are at version ~[2.112.0](https://dlang.org/changelog/2.112.0.html), incl. new command-line options `-extI`, `-dllimport=externalOnly` and `-edition`. (#4949, #4962, #4988, #5029)
- Support for [LLVM 21](https://releases.llvm.org/21.1.0/docs/ReleaseNotes.html). Beware that patch versions before v21.1.8 seem to misoptimize `std.json`. (#4950, #5033)
- **Breaking change for dcompute**: The special `@kernel` UDA is now a function and _**requires**_ parentheses as in `@kernel() void foo(){}`. Optionally you can provide launch dimensions, `@kernel([2,4,8])`, to specify to the compute runtime how the kernel is intended to be launched.
- ldc2.conf can now be a directory. All the files inside it, ordered naturally, will be concatenated and treated like a big config. (#4954)
- Running `ldc-build-runtime --installWithSuffix` now includes installing a target-specific .conf file to that directory. (#4978)
Expand All @@ -15,6 +16,7 @@
- The prebuilt arm64/universal macOS packages additionally bundle the arm64 iOS-*simulator* libraries, for out-of-the-box cross-compilation support via e.g. `-mtriple=arm64-apple-ios12.0-simulator`. (#4974)

#### Platform support
- Supports LLVM 15 - 21.

#### Bug fixes

Expand Down
7 changes: 5 additions & 2 deletions cmake/Modules/FindLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
# system default locations such as /usr/local/bin. Executing find_program()
# multiples times is the approach recommended in the docs.
set(llvm_config_names llvm-config-20.1 llvm-config201 llvm-config-20
set(llvm_config_names llvm-config-21.1 llvm-config211 llvm-config-21
llvm-config-20.1 llvm-config201 llvm-config-20
llvm-config-19.1 llvm-config191 llvm-config-19
llvm-config-18.1 llvm-config181 llvm-config-18
llvm-config-17.0 llvm-config170 llvm-config-17
Expand All @@ -48,10 +49,12 @@ if(APPLE)
# extra fallbacks for MacPorts & Homebrew
find_program(LLVM_CONFIG
NAMES ${llvm_config_names}
PATHS /opt/local/libexec/llvm-20/bin /opt/local/libexec/llvm-19/bin
PATHS /opt/local/libexec/llvm-21/bin
/opt/local/libexec/llvm-20/bin /opt/local/libexec/llvm-19/bin
/opt/local/libexec/llvm-18/bin /opt/local/libexec/llvm-17/bin
/opt/local/libexec/llvm-16/bin /opt/local/libexec/llvm-15/bin
/opt/local/libexec/llvm/bin
/usr/local/opt/llvm@21/bin
/usr/local/opt/llvm@20/bin /usr/local/opt/llvm@19/bin
/usr/local/opt/llvm@18/bin /usr/local/opt/llvm@17/bin
/usr/local/opt/llvm@16/bin /usr/local/opt/llvm@15/bin
Expand Down
12 changes: 5 additions & 7 deletions gen/passes/GarbageCollect2Stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,18 +746,16 @@ bool isSafeToStackAllocate(BasicBlock::iterator Alloc, Value *V,
for (auto A = B; A != E; ++A) {
if (A->get() == V) {
#if LDC_LLVM_VER >= 2100
if (CB->paramHasAttr(A - B, llvm::Attribute::AttrKind::Captures)) {
return capturesNothing(
CB->getParamAttr(A - B, llvm::Attribute::AttrKind::Captures)
.getCaptureInfo());
}

if (!(CB->paramHasAttr(A - B, llvm::Attribute::AttrKind::Captures) &&
capturesNothing(
CB->getParamAttr(A - B, llvm::Attribute::AttrKind::Captures)
.getCaptureInfo()))) {
#else
if (!CB->paramHasAttr(A - B, llvm::Attribute::AttrKind::NoCapture)) {
#endif
// The parameter is not marked 'nocapture' - captured.
return false;
}
#endif

if (auto call = dyn_cast<CallInst>(static_cast<Instruction *>(CB))) {
if (call->isTailCall()) {
Expand Down
2 changes: 1 addition & 1 deletion runtime/druntime/src/ldc/intrinsics.di
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ else version (LDC_LLVM_1800) enum LLVM_version = 1800;
else version (LDC_LLVM_1801) enum LLVM_version = 1801;
else version (LDC_LLVM_1901) enum LLVM_version = 1901;
else version (LDC_LLVM_2001) enum LLVM_version = 2001;
else version (LDC_LLVM_2100) enum LLVM_version = 2100;
else version (LDC_LLVM_2101) enum LLVM_version = 2101;
else version (LDC_LLVM_2200) enum LLVM_version = 2200;
else static assert(false, "LDC LLVM version not supported");

Expand Down
8 changes: 4 additions & 4 deletions tests/codegen/align.d
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ Outer passAndReturnOuterByVal(Outer arg) { return arg; }
// CHECK-SAME: ptr {{noalias sret.*|inreg noalias}} align 32 %.sret_arg
/* How the arg is passed by value is ABI-specific, but the pointer must be aligned.
* When the argument is passed as a byte array and copied into a stack alloc, that stack alloca must be aligned. */
// CHECK: {{(align 32 %arg|%arg = alloca %align.Outer, align 32)}}
// CHECK: {{(align 32 %arg|%arg = alloca %align.Outer, align 32|call void @llvm.memcpy.* %.sret_arg,.* %arg)}}

Inner passAndReturnInnerByVal(Inner arg) { return arg; }
// CHECK: define{{.*}} void @{{.*}}_D5align23passAndReturnInnerByValFSQBh5InnerZQl
// CHECK-SAME: ptr {{noalias sret.*|inreg noalias}} align 32 %.sret_arg
// CHECK: {{(align 32 %arg|%arg = alloca %align.Inner, align 32)}}
// CHECK: {{(align 32 %arg|%arg = alloca %align.Inner, align 32|call void @llvm.memcpy.* %.sret_arg,.* %arg)}}

void main() {
Outer outer;
Expand Down Expand Up @@ -61,11 +61,11 @@ void main() {
// CHECK: call{{.*}} void @{{.*}}_D5align23passAndReturnOuterByValFSQBh5OuterZQl
// CHECK-SAME: ptr {{noalias sret.*|inreg noalias}} align 32 %.sret_tmp
// The argument is either passed by aligned (optimizer hint) pointer or as an array of i32/64 and copied into an aligned stack slot inside the callee.
// CHECK-SAME: {{(align 32 %|\[[0-9]+ x i..\])}}
// CHECK-SAME: {{(align 32 |\[[0-9]+ x i..\])}}

inner = passAndReturnInnerByVal(inner);
// CHECK: call{{.*}} void @{{.*}}_D5align23passAndReturnInnerByValFSQBh5InnerZQl
// CHECK-SAME: ptr {{noalias sret.*|inreg noalias}} align 32 %.sret_tmp
// The argument is either passed by aligned (optimizer hint) pointer or as an array of i32/64 and copied into an aligned stack slot inside the callee.
// CHECK-SAME: {{(align 32 %|\[[0-9]+ x i..\])}}
// CHECK-SAME: {{(align 32 |\[[0-9]+ x i..\])}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ uint getHighHalfOfGlobal(ulong value)
{
asm
{
// CHECK: movl ((4+(-8))+_someGlobalVariable)+8, %eax
// CHECK: movl {{\(?\(?4\+\(?-8\)?\)?\+_someGlobalVariable\)?\+8}}, %eax
mov EAX, dword ptr [someGlobalVariable + 4];
}
}
Expand Down
Loading