automatic version update by autodist [release 1.32.2-1mamba;Sun May 28 2023]

This commit is contained in:
Automatic Build System 2024-01-06 03:35:19 +01:00
parent 56f7cdd84c
commit af12608fcd
10 changed files with 3432 additions and 6755 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
--- ldc-1.32.2/gen/optimizer.cpp.orig 2023-05-28 16:28:05.653166497 +0200
+++ ldc-1.32.2/gen/optimizer.cpp 2023-05-28 16:28:54.543949601 +0200
@@ -654,7 +654,11 @@
bool debugLogging = false;
ppo.Indent = false;
ppo.SkipAnalyses = false;
+ #if LDC_LLVM_VER < 1600
StandardInstrumentations si(debugLogging, verifyEach, ppo);
+ #else
+ StandardInstrumentations si(M->getContext(), debugLogging, /*VerifyEach=*/false, ppo);
+ #endif
si.registerCallbacks(pic, &fam);

View File

@ -0,0 +1,29 @@
From 25cf7f83ce7e1b071912a015b366ce8f71783306 Mon Sep 17 00:00:00 2001
From: Ikey Doherty <ikey@serpentos.com>
Date: Mon, 22 May 2023 09:06:43 +0100
Subject: [PATCH] driver/targetmachine: Fix aarch64 support for LLVM >= 1600
This isn't *the* most ideal approach and in future we may want
to select specific fallbacks other than "generic".
Signed-off-by: Ikey Doherty <ikey@serpentos.com>
---
driver/targetmachine.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/driver/targetmachine.cpp b/driver/targetmachine.cpp
index be47a1dc93..3f16e20813 100644
--- a/driver/targetmachine.cpp
+++ b/driver/targetmachine.cpp
@@ -203,9 +203,11 @@ static std::string getARMTargetCPU(const llvm::Triple &triple) {
}
static std::string getAArch64TargetCPU(const llvm::Triple &triple) {
+#if LDC_LLVM_VER < 1600
auto defaultCPU = llvm::AArch64::getDefaultCPU(triple.getArchName());
if (!defaultCPU.empty())
return std::string(defaultCPU);
+#endif
return "generic";
}

View File

@ -0,0 +1,31 @@
From 4d5b7dc86e5a282914b46c4982f612228bb75bb0 Mon Sep 17 00:00:00 2001
From: Ikey Doherty <ikey@serpentos.com>
Date: Mon, 22 May 2023 08:48:56 +0100
Subject: [PATCH] gen/ms-cxx-helper: Use new `insertInto` LLVM16 API
Instructions now use friend APIs to add themselves into a
BasicBlock, rather than a BasicBlock having an API to add
the instructions.
Signed-off-by: Ikey Doherty <ikey@serpentos.com>
---
gen/ms-cxx-helper.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gen/ms-cxx-helper.cpp b/gen/ms-cxx-helper.cpp
index 52814fd5cf..9f4eb7627f 100644
--- a/gen/ms-cxx-helper.cpp
+++ b/gen/ms-cxx-helper.cpp
@@ -114,7 +114,12 @@ void cloneBlocks(const std::vector<llvm::BasicBlock *> &srcblocks,
if (!newInst)
newInst = Inst->clone();
+ #if LDC_LLVM_VER < 1600
nbb->getInstList().push_back(newInst);
+ #else
+ newInst->insertInto(nbb, nbb->end());
+ #endif
+
VMap[Inst] = newInst; // Add instruction map to value.
if (unwindTo)
if (auto dest = getUnwindDest(Inst))

View File

@ -0,0 +1,29 @@
From 097c9787d6d76cd069e90fdeccc083ccec5b9631 Mon Sep 17 00:00:00 2001
From: Ikey Doherty <ikey@serpentos.com>
Date: Mon, 22 May 2023 09:01:59 +0100
Subject: [PATCH] driver/main: For LLVM > 16, stop using AggressiveInstCombine
This was killed upstream in the codegen pipeline as part of a bunch of
legacy PM removals:
- https://reviews.llvm.org/D137116
Signed-off-by: Ikey Doherty <ikey@serpentos.com>
---
driver/main.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/driver/main.cpp b/driver/main.cpp
index 6d1c3441eb..fcaaf28983 100644
--- a/driver/main.cpp
+++ b/driver/main.cpp
@@ -579,7 +579,9 @@ void initializePasses() {
#endif
initializeVectorization(Registry);
initializeInstCombine(Registry);
+#if LDC_LLVM_VER < 1600
initializeAggressiveInstCombine(Registry);
+#endif
initializeIPO(Registry);
#if LDC_LLVM_VER < 1600
initializeInstrumentation(Registry);

View File

@ -0,0 +1,25 @@
From 815684cd36cc438c7b0ebfea672abdd107dd7c96 Mon Sep 17 00:00:00 2001
From: Ikey Doherty <ikey@serpentos.com>
Date: Mon, 22 May 2023 08:40:52 +0100
Subject: [PATCH] gen/runtime: Use the correct header path for ModRef
In stable LLVM 16 this is now under `Support` and not `IR`
Signed-off-by: Ikey Doherty <ikey@serpentos.com>
---
gen/runtime.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gen/runtime.cpp b/gen/runtime.cpp
index 37cd6dc741..c2040341f2 100644
--- a/gen/runtime.cpp
+++ b/gen/runtime.cpp
@@ -33,7 +33,7 @@
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/Attributes.h"
#if LDC_LLVM_VER >= 1600
-#include "llvm/IR/ModRef.h"
+#include "llvm/Support/ModRef.h"
#endif
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"

View File

@ -0,0 +1,204 @@
From 8e1dffa5203439996d6c461485cad566ec321884 Mon Sep 17 00:00:00 2001
From: Ikey Doherty <ikey@serpentos.com>
Date: Mon, 22 May 2023 10:53:55 +0100
Subject: [PATCH] For LLVM >= 16, use std::optional APIs
Unfortunately when building with LLVM < 15, we're using C++-11,
so the std::optional bits are only available in C++-17.
Even more unfortunately we can't really override this, rather
inherit the fact of using C++-17 when using LLVM > 16.
Thus, we add a slightly messy conditional compilation situation
to allow usage of LDC on older LLVM versions, and with newer
LLVM/libcxx.
Signed-off-by: Ikey Doherty <ikey@serpentos.com>
---
driver/args.cpp | 4 ++++
driver/linker.cpp | 4 ++++
driver/linker.h | 4 ++++
gen/dcompute/druntime.cpp | 7 ++++++-
gen/dibuilder.cpp | 21 +++++++++++++++++++++
gen/optimizer.cpp | 5 +++++
gen/uda.cpp | 4 ++++
utils/not.cpp | 4 ++++
8 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/driver/args.cpp b/driver/args.cpp
index da291202d1..bad8e45dee 100644
--- a/driver/args.cpp
+++ b/driver/args.cpp
@@ -175,7 +175,11 @@ int executeAndWait(std::vector<const char *> fullArgs,
}
const std::vector<llvm::StringRef> argv = toRefsVector(fullArgs);
+#if LDC_LLVM_VER < 1600
auto envVars = llvm::None;
+#else
+ auto envVars = std::nullopt;
+#endif
return llvm::sys::ExecuteAndWait(argv[0], argv, envVars, {}, 0, 0, errorMsg);
}
diff --git a/driver/linker.cpp b/driver/linker.cpp
index 76266379d2..803d5e883e 100644
--- a/driver/linker.cpp
+++ b/driver/linker.cpp
@@ -195,7 +195,11 @@ static std::vector<std::string> getDefaultLibNames() {
llvm::Optional<std::vector<std::string>> getExplicitPlatformLibs() {
if (platformLib.getNumOccurrences() > 0)
return parseLibNames(platformLib);
+#if LDC_LLVM_VER < 1600
return llvm::None;
+#else
+ return std::nullopt;
+#endif
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/driver/linker.h b/driver/linker.h
index f962054efa..28362d8652 100644
--- a/driver/linker.h
+++ b/driver/linker.h
@@ -42,7 +42,11 @@ bool linkAgainstSharedDefaultLibs();
/**
* Returns the -platformlib library names, if specified.
*/
+#if LDC_LLVM_VER < 1600
llvm::Optional<std::vector<std::string>> getExplicitPlatformLibs();
+#else
+std::optional<std::vector<std::string>> getExplicitPlatformLibs();
+#endif
/**
* Returns the value of -mscrtlib.
diff --git a/gen/dcompute/druntime.cpp b/gen/dcompute/druntime.cpp
index 6867765466..aee93f4c53 100644
--- a/gen/dcompute/druntime.cpp
+++ b/gen/dcompute/druntime.cpp
@@ -42,8 +42,13 @@ bool isFromLDC_OpenCL(Dsymbol *sym) {
}
llvm::Optional<DcomputePointer> toDcomputePointer(StructDeclaration *sd) {
- if (sd->ident != Id::dcPointer || !isFromLDC_DCompute(sd))
+ if (sd->ident != Id::dcPointer || !isFromLDC_DCompute(sd)) {
+#if LDC_LLVM_VER < 1600
return llvm::Optional<DcomputePointer>(llvm::None);
+#else
+ return std::optional<DcomputePointer>(std::nullopt);
+#endif
+ }
TemplateInstance *ti = sd->isInstantiated();
int addrspace = isExpression((*ti->tiargs)[0])->toInteger();
diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp
index 1e817ee3f4..f7068294dd 100644
--- a/gen/dibuilder.cpp
+++ b/gen/dibuilder.cpp
@@ -372,7 +372,11 @@ DIType DIBuilder::CreateEnumType(TypeEnum *type) {
DIType DIBuilder::CreatePointerType(TypePointer *type) {
// TODO: The addressspace is important for dcompute targets. See e.g.
// https://www.mail-archive.com/dwarf-discuss@lists.dwarfstd.org/msg00326.html
+#if LDC_LLVM_VER < 1600
const llvm::Optional<unsigned> DWARFAddressSpace = llvm::None;
+#else
+ const std::optional<unsigned> DWARFAddressSpace = std::nullopt;
+#endif
const auto name = processDIName(type->toPrettyChars(true));
@@ -730,7 +734,11 @@ DISubroutineType DIBuilder::CreateFunctionType(Type *type) {
}
DISubroutineType DIBuilder::CreateEmptyFunctionType() {
+#if LDC_LLVM_VER < 1600
auto paramsArray = DBuilder.getOrCreateTypeArray(llvm::None);
+#else
+ auto paramsArray = DBuilder.getOrCreateTypeArray(std::nullopt);
+#endif
return DBuilder.createSubroutineType(paramsArray);
}
@@ -774,9 +782,16 @@ DIType DIBuilder::CreateTypeDescription(Type *t, bool voidToUbyte) {
return nullptr;
if (t->ty == TY::Tnull) {
// display null as void*
+#if LDC_LLVM_VER < 1600
return DBuilder.createPointerType(
CreateTypeDescription(Type::tvoid), target.ptrsize * 8, 0,
/* DWARFAddressSpace */ llvm::None, "typeof(null)");
+#else
+ return DBuilder.createPointerType(
+ CreateTypeDescription(Type::tvoid), target.ptrsize * 8, 0,
+ /* DWARFAddressSpace */ std::nullopt, "typeof(null)");
+#endif
+
}
if (auto te = t->isTypeEnum())
return CreateEnumType(te);
@@ -798,8 +813,14 @@ DIType DIBuilder::CreateTypeDescription(Type *t, bool voidToUbyte) {
const auto aggregateDIType = CreateCompositeType(t);
const auto name =
(tc->sym->toPrettyChars(true) + llvm::StringRef("*")).str();
+#if LDC_LLVM_VER < 1600
return DBuilder.createPointerType(aggregateDIType, target.ptrsize * 8, 0,
llvm::None, processDIName(name));
+#else
+ return DBuilder.createPointerType(aggregateDIType, target.ptrsize * 8, 0,
+ std::nullopt, processDIName(name));
+#endif
+
}
if (auto tf = t->isTypeFunction())
return CreateFunctionType(tf);
diff --git a/gen/optimizer.cpp b/gen/optimizer.cpp
index 86146bf6f3..13bad60a04 100644
--- a/gen/optimizer.cpp
+++ b/gen/optimizer.cpp
@@ -572,8 +572,13 @@ static llvm::Optional<PGOOptions> getPGOOptions() {
PGOOptions::CSPGOAction::NoCSAction,
debugInfoForProfiling, pseudoProbeForProfiling);
}
+#if LDC_LLVM_VER < 1600
return None;
+#else
+ return std::nullopt;
+#endif
}
+
static PipelineTuningOptions getPipelineTuningOptions(unsigned optLevelVal, unsigned sizeLevelVal) {
PipelineTuningOptions pto;
diff --git a/gen/uda.cpp b/gen/uda.cpp
index 371b565b38..521205c5da 100644
--- a/gen/uda.cpp
+++ b/gen/uda.cpp
@@ -219,7 +219,11 @@ void applyAttrAllocSize(StructLiteralExp *sle, IrFunction *irFunc) {
if (numArgIdx >= 0) {
builder.addAllocSizeAttr(llvmSizeIdx, llvmNumIdx);
} else {
+#if LDC_LLVM_VER < 1600
builder.addAllocSizeAttr(llvmSizeIdx, llvm::Optional<unsigned>());
+#else
+ builder.addAllocSizeAttr(llvmSizeIdx, std::optional<unsigned>());
+#endif
}
llvm::Function *func = irFunc->getLLVMFunc();
diff --git a/utils/not.cpp b/utils/not.cpp
index b434af7331..7ca8d1d8a6 100644
--- a/utils/not.cpp
+++ b/utils/not.cpp
@@ -43,7 +43,11 @@ int main(int argc, const char **argv) {
Argv.reserve(argc);
for (int i = 0; i < argc; ++i)
Argv.push_back(argv[i]);
+#if LDC_LLVM_VER < 1600
auto Env = llvm::None;
+#else
+ auto Env = std::nullopt;
+#endif
std::string ErrMsg;
int Result = sys::ExecuteAndWait(*Program, Argv, Env, {}, 0, 0, &ErrMsg);

View File

@ -0,0 +1,30 @@
--- ldc-1.32.2/driver/args.h.orig 2023-05-28 16:39:55.277642880 +0200
+++ ldc-1.32.2/driver/args.h 2023-05-28 16:43:17.582551616 +0200
@@ -40,8 +40,8 @@
// Executes a command line and returns its exit code.
// Optionally uses a response file to overcome cmdline length limitations.
int executeAndWait(std::vector<const char *> fullArgs,
- llvm::Optional<llvm::sys::WindowsEncodingMethod>
- responseFileEncoding = {llvm::None},
+ std::optional<llvm::sys::WindowsEncodingMethod>
+ responseFileEncoding = {std::nullopt},
std::string *errorMsg = nullptr);
} // namespace args
--- ldc-1.32.2/driver/args.cpp.orig 2023-05-28 16:43:44.700403861 +0200
+++ ldc-1.32.2/driver/args.cpp 2023-05-28 16:46:39.739443702 +0200
@@ -159,11 +159,11 @@
int executeAndWait(
std::vector<const char *> fullArgs,
- llvm::Optional<llvm::sys::WindowsEncodingMethod> responseFileEncoding,
+ std::optional<llvm::sys::WindowsEncodingMethod> responseFileEncoding,
std::string *errorMsg) {
args::ResponseFile rspFile;
- if (responseFileEncoding.hasValue() &&
- !rspFile.setup(fullArgs, responseFileEncoding.getValue())) {
+ if (responseFileEncoding.has_value() &&
+ !rspFile.setup(fullArgs, responseFileEncoding.value())) {
if (errorMsg)
*errorMsg = "could not write temporary response file";
return -1;

View File

@ -1,7 +1,7 @@
%define bootstrap 0
#% define bootstrap 0
Name: ldc
Version: 1.31.0
Release: 2mamba
Version: 1.32.2
Release: 1mamba
Summary: The LLVM-based D Compiler
Group: Applications/Development
Vendor: openmamba
@ -12,17 +12,24 @@ Source: https://github.com/ldc-developers/ldc.git/v%{version}/ldc-%{versi
Source1: https://github.com/ldc-developers/ldc/releases/download/v%{version}/ldc2-%{version}-linux-x86_64.tar.xz
Source2: https://github.com/ldc-developers/ldc/releases/download/v1.2.0/ldc2-1.2.0-linux-x86.tar.xz
Source3: https://github.com/ldc-developers/ldc/releases/download/v%{version}/ldc2-%{version}-linux-aarch64.tar.xz
Patch0: ldc-1.23.0-llvm-11.patch
Patch0: ldc-1.32.2-llvm-16-update_to_ir_include.patch
Patch1: ldc-1.32.2-llvm-16-context_usage.patch
Patch2: ldc-1.32.2-llvm-16-fix-ms_cxx_helper.patch
Patch3: ldc-1.32.2-llvm-16-stop_using_aggressive_combine.patch
Patch4: ldc-1.32.2-llvm-16-fix-aarch64-support.patch
Patch5: ldc-1.32.2-llvm-16-use_std_optional_api.patch
Patch6: ldc-1.32.2-llvm-16-add_llvm_profdata.patch
Patch7: ldc-1.32.2-llvm-16.0.4-use_std_optional_api.patch
License: BSD
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libgcc
BuildRequires: liblld-devel
BuildRequires: libllvm-devel
BuildRequires: libspirv-llvm-translator-devel
BuildRequires: libstdc++6-devel
## AUTOBUILDREQ-END
BuildRequires: cmake
BuildRequires: libllvm-devel >= 14.0.3
BuildRequires: libllvm-devel >= 16.0.4
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
%description
@ -46,7 +53,7 @@ This package contains libraries and header files for developing applications tha
%debug_package
%prep
%if "0%{?bootstrap}"
%if "%{?bootstrap}" != ""
%ifarch x86_64
%setup -q -a1
%endif
@ -59,21 +66,24 @@ This package contains libraries and header files for developing applications tha
%else
%setup -q
%endif
#%patch0 -p1
%patch 0 -p1 -b .llvm-16-update_to_ir_include
%patch 1 -p1 -b .llvm-16-context_usage
%patch 2 -p1 -b .llvm-16-add_llvm_profdata
%patch 3 -p1 -b .llvm-16-fix-ms_cxx_helper
%patch 4 -p1 -b .llvm-16-stop_using_aggressive_combine
%patch 5 -p1 -b .llvm-16-fix-aarch64-support
%patch 6 -p1 -b .llvm-16-use_std_optional_api
%patch 7 -p1 -b .llvm-16.0.4-use_std_optional_api
%build
%cmake -d build \
-DBUILD_SHARED_LIBS=BOTH \
-DBUILD_LTO_LIBS=ON \
-DLDC_WITH_LLD=OFF \
%ifarch x86_64 aarch64
-DD_COMPILER_FLAGS="-link-defaultlib-shared=false -linker=gold --flto=thin" \
%else
-DD_COMPILER_FLAGS="-link-defaultlib-shared=false --flto=thin" \
%endif
-DADDITIONAL_DEFAULT_LDC_SWITCHES="\"-link-defaultlib-shared\"" \
-DINCLUDE_INSTALL_DIR=%{_includedir}/d \
%if "0%{?bootstrap}" != "0"
-DINCLUDE_INSTALL_DIR=%{_includedir}/dlang/ldc \
%if "%{?bootstrap}" != ""
%ifarch x86_64
-DD_COMPILER=`pwd`/../ldc2-%{version}-linux-x86_64/bin/ldmd2
%endif
@ -106,6 +116,7 @@ This package contains libraries and header files for developing applications tha
%{_bindir}/ldc-prune-cache
%{_bindir}/ldc2
%{_bindir}/ldmd2
%{_bindir}/timetrace2txt
%{_datadir}/bash-completion/completions/ldc2
%files -n lib%{name}
@ -119,18 +130,8 @@ This package contains libraries and header files for developing applications tha
%files -n lib%{name}-devel
%defattr(-,root,root)
%dir %{_includedir}/d
%dir %{_includedir}/d/core
%{_includedir}/d/core/*
%dir %{_includedir}/d/etc
%{_includedir}/d/etc/*
%dir %{_includedir}/d/ldc
%{_includedir}/d/ldc/*
%{_includedir}/d/object.d
%dir %{_includedir}/d/std
%{_includedir}/d/std/*
%{_includedir}/d/__builtins.di
%{_includedir}/d/importc.h
%dir %{_includedir}/dlang/ldc
%{_includedir}/dlang/ldc/*
%{_libdir}/ldc_rt.dso.o
%{_libdir}/libdruntime-ldc-debug-shared.so
%{_libdir}/libdruntime-ldc-shared.so
@ -141,6 +142,15 @@ This package contains libraries and header files for developing applications tha
%doc README.md
%changelog
* Sun May 28 2023 Automatic Build System <autodist@mambasoft.it> 1.32.2-1mamba
- automatic version update by autodist
* Tue Apr 18 2023 Automatic Build System <autodist@mambasoft.it> 1.32.1-1mamba
- automatic version update by autodist
* Tue Mar 14 2023 Automatic Build System <autodist@mambasoft.it> 1.32.0-1mamba
- automatic version update by autodist
* Sun Mar 12 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 1.31.0-2mamba
- rebuiult with more cmake flags as attempt to fix 'Error: unrecognized trait classInstanceAlignment'