diff options
18 files changed, 2 insertions, 1339 deletions
diff --git a/groups/010.host_deps.group b/groups/010.host_deps.group index 359e6e46..62953a1e 100644 --- a/groups/010.host_deps.group +++ b/groups/010.host_deps.group @@ -10,10 +10,10 @@ HOST_DEPS_LDFLAGS_CONFIGURE="-L${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib"; HOST_DEPS_MAKEFLAGS_INSTALL="prefix= PREFIX="; HOST_DEPS_PACKAGES=" binutils_build bison_host bmake_host bzip2_host ca_certificates_host -chainport_host clang_host clzip_host cmake_host +chainport_host clzip_host cmake_host expat_host file_host flex_host gdb_host gdbm_host glib_host gperf_host infounzip_host infozip_host intltool_host libffi_host -libressl_host libz_host libzip_host llvm_host mdso_host mpackage_host +libressl_host libz_host libzip_host mdso_host mpackage_host musl_fts_host ncurses_host ncursestw_host ncursesw_host pcre_host perk_host python2_host python3_host readline_host ruby_host sbsigntools_host sqlite3_host texinfo_host tzdb_host util_linux_host xz_host"; @@ -60,19 +60,6 @@ HOST_DEPS_TOOLS_RPM_DISABLE=1; : ${PKG_CHAINPORT_HOST_INSTALL_FILES_V2:=" -=%[_workdir]/chainport +../chainport=%[_workdir]/chainport"}; -: ${PKG_CLANG_HOST_DEPENDS:="llvm_host"}; -: ${PKG_CLANG_HOST_SHA256SUM:=4cd3836dfb4b88b597e075341cae86d61c63ce3963e45c7fe6a8bf59bb382cdf}; -: ${PKG_CLANG_HOST_VERSION:=3.8.1}; -: ${PKG_CLANG_HOST_URL:=http://releases.llvm.org/${PKG_CLANG_HOST_VERSION}/cfe-${PKG_CLANG_HOST_VERSION}.src.tar.xz}; -: ${PKG_CLANG_HOST_DISABLED:=1}; -: ${PKG_CLANG_HOST_CMAKE_ARGS_EXTRA:=" - -DCLANG_BUILD_EXAMPLES:BOOL=OFF - -DCLANG_INCLUDE_DOCS:BOOL=OFF - -DCLANG_INCLUDE_TESTS:BOOL=OFF - -DLIBCLANG_BUILD_STATIC:BOOL=ON - -DLLVM_PREFIX=${PREFIX_NATIVE} - -G Unix Makefiles - -Wno-dev"}; : ${PKG_CLZIP_HOST_SHA256SUM:=d9d51212afa80371dc2546d278ef8ebbb3cd57c06fdd761b7b204497586d24c0}; : ${PKG_CLZIP_HOST_VERSION:=1.11}; : ${PKG_CLZIP_HOST_URL:=http://download.savannah.gnu.org/releases/lzip/clzip/clzip-${PKG_CLZIP_HOST_VERSION}.tar.gz}; @@ -163,20 +150,6 @@ HOST_DEPS_TOOLS_RPM_DISABLE=1; : ${PKG_LIBZIP_HOST_CMAKE_ARGS_EXTRA:=" -DENABLE_GNUTLS=:BOOL=OFF -DENABLE_MBEDTLS=:BOOL=OFF"}; -: ${PKG_LLVM_HOST_SHA256SUM:=6e82ce4adb54ff3afc18053d6981b6aed1406751b8742582ed50f04b5ab475f9}; -: ${PKG_LLVM_HOST_VERSION:=3.8.1}; -: ${PKG_LLVM_HOST_URL:=http://releases.llvm.org/${PKG_LLVM_HOST_VERSION}/llvm-${PKG_LLVM_HOST_VERSION}.src.tar.xz}; -: ${PKG_LLVM_HOST_DISABLED:=1}; -: ${PKG_LLVM_HOST_CMAKE_ARGS_EXTRA:=" - -DCMAKE_BUILD_TYPE=Release - -DLLVM_BUILD_DOCS=NO - -DLLVM_BUILD_EXAMPLES=NO - -DLLVM_BUILD_TESTS=NO - -DLLVM_ENABLE_SPHINX=NO - -DLLVM_TARGETS_TO_BUILD=X86 - -DSPHINX_WARNINGS_AS_ERRORS=NO - -G Unix Makefiles - -Wno-dev"}; : ${PKG_MDSO_HOST_URLS_GIT:="mdso=${DEFAULT_GITROOT}/mdso"}; : ${PKG_MDSO_HOST_CONFIGURE_ARGS:="--prefix="}; : ${PKG_MDSO_HOST_INSTALL_FILES_V2:=" diff --git a/patches/clang_host/clang-0001-Add-Alpine-Linux-distro.patch b/patches/clang_host/clang-0001-Add-Alpine-Linux-distro.patch deleted file mode 100644 index 6cbed09d..00000000 --- a/patches/clang_host/clang-0001-Add-Alpine-Linux-distro.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 4559c66aabd8b56f7127c8b1f5d22f59d3ca2390 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 18 Feb 2016 17:40:00 +0100 -Subject: [PATCH 1/7] Add Alpine Linux distro - ---- - lib/Driver/ToolChains.cpp | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 99c7b8e..70b53bd 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -3374,6 +3374,7 @@ enum Distro { - // NB: Releases of a particular Linux distro should be kept together - // in this enum, because some tests are done by integer comparison against - // the first and last known member in the family, e.g. IsRedHat(). -+ AlpineLinux, - ArchLinux, - DebianLenny, - DebianSqueeze, -@@ -3497,6 +3498,9 @@ static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) { - if (D.getVFS().exists("/etc/arch-release")) - return ArchLinux; - -+ if (D.getVFS().exists("/etc/alpine-release")) -+ return AlpineLinux; -+ - return UnknownDistro; - } - --- -2.7.3 - diff --git a/patches/clang_host/clang-0002-Use-z-relro-on-Alpine-Linux.patch b/patches/clang_host/clang-0002-Use-z-relro-on-Alpine-Linux.patch deleted file mode 100644 index 090ec3d5..00000000 --- a/patches/clang_host/clang-0002-Use-z-relro-on-Alpine-Linux.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 1898d32d22fddf3ba6c88addbd2af0159600b506 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 18 Feb 2016 17:41:23 +0100 -Subject: [PATCH 2/7] Use "-z relro" on Alpine Linux - ---- - lib/Driver/ToolChains.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 70b53bd..46326f0 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -3667,7 +3667,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - - Distro Distro = DetectDistro(D, Arch); - -- if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { -+ if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) { - ExtraOpts.push_back("-z"); - ExtraOpts.push_back("relro"); - } --- -2.7.3 - diff --git a/patches/clang_host/clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch b/patches/clang_host/clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch deleted file mode 100644 index 4dc9842f..00000000 --- a/patches/clang_host/clang-0003-Use-hash-style-gnu-for-Alpine-Linux.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b880ea7037ea3232be9ba2e96cc179da92ea4b9c Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 18 Feb 2016 17:43:51 +0100 -Subject: [PATCH 3/7] Use --hash-style=gnu for Alpine Linux - ---- - lib/Driver/ToolChains.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 46326f0..6b0b31d 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -3687,8 +3687,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - // ABI requires a mapping between the GOT and the symbol table. - // Android loader does not support .gnu.hash. - if (!IsMips && !IsAndroid) { -- if (IsRedhat(Distro) || IsOpenSUSE(Distro) || -- (IsUbuntu(Distro) && Distro >= UbuntuMaverick)) -+ if (IsRedhat(Distro) || IsOpenSUSE(Distro) || Distro == AlpineLinux || -+ (IsUbuntu(Distro) && Distro >= UbuntuMaverick)) - ExtraOpts.push_back("--hash-style=gnu"); - - if (IsDebian(Distro) || IsOpenSUSE(Distro) || Distro == UbuntuLucid || --- -2.7.3 - diff --git a/patches/clang_host/clang-0004-Add-musl-targets-and-dynamic-linker.patch b/patches/clang_host/clang-0004-Add-musl-targets-and-dynamic-linker.patch deleted file mode 100644 index 6384b088..00000000 --- a/patches/clang_host/clang-0004-Add-musl-targets-and-dynamic-linker.patch +++ /dev/null @@ -1,222 +0,0 @@ -From 4777c16fc6e717a852366fa2a447c852cca3b62d Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Fri, 19 Feb 2016 13:35:08 +0100 -Subject: [PATCH 4/7] Add musl targets and dynamic linker - ---- - lib/Basic/Targets.cpp | 2 ++ - lib/CodeGen/TargetInfo.cpp | 6 +++++- - lib/Driver/ToolChains.cpp | 15 ++++++++++----- - lib/Driver/Tools.cpp | 44 +++++++++++++++++++++++++++++++++++++++++++- - 4 files changed, 60 insertions(+), 7 deletions(-) - -diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp -index af8aea0..1e27c7a 100644 ---- a/lib/Basic/Targets.cpp -+++ b/lib/Basic/Targets.cpp -@@ -4513,6 +4513,8 @@ public: - case llvm::Triple::Android: - case llvm::Triple::GNUEABI: - case llvm::Triple::GNUEABIHF: -+ case llvm::Triple::MuslEABI: -+ case llvm::Triple::MuslEABIHF: - setABI("aapcs-linux"); - break; - case llvm::Triple::EABIHF: -diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp -index 3d1ddef..f6b3474 100644 ---- a/lib/CodeGen/TargetInfo.cpp -+++ b/lib/CodeGen/TargetInfo.cpp -@@ -4757,6 +4757,8 @@ public: - case llvm::Triple::EABIHF: - case llvm::Triple::GNUEABI: - case llvm::Triple::GNUEABIHF: -+ case llvm::Triple::MuslEABI: -+ case llvm::Triple::MuslEABIHF: - return true; - default: - return false; -@@ -4767,6 +4769,7 @@ public: - switch (getTarget().getTriple().getEnvironment()) { - case llvm::Triple::EABIHF: - case llvm::Triple::GNUEABIHF: -+ case llvm::Triple::MuslEABIHF: - return true; - default: - return false; -@@ -7492,7 +7495,8 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() { - Kind = ARMABIInfo::AAPCS16_VFP; - else if (CodeGenOpts.FloatABI == "hard" || - (CodeGenOpts.FloatABI != "soft" && -- Triple.getEnvironment() == llvm::Triple::GNUEABIHF)) -+ (Triple.getEnvironment() == llvm::Triple::GNUEABIHF || -+ Triple.getEnvironment() == llvm::Triple::MuslEABIHF))) - Kind = ARMABIInfo::AAPCS_VFP; - - return *(TheTargetCodeGenInfo = new ARMTargetCodeGenInfo(Types, Kind)); -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 6b0b31d..0db9644 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -1523,7 +1523,8 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const { - case llvm::Triple::arm: - case llvm::Triple::thumb: - LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs)); -- if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) { -+ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF || -+ TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) { - TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples)); - } else { - TripleAliases.append(begin(ARMTriples), end(ARMTriples)); -@@ -1532,7 +1533,8 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const { - case llvm::Triple::armeb: - case llvm::Triple::thumbeb: - LibDirs.append(begin(ARMebLibDirs), end(ARMebLibDirs)); -- if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) { -+ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF || -+ TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) { - TripleAliases.append(begin(ARMebHFTriples), end(ARMebHFTriples)); - } else { - TripleAliases.append(begin(ARMebTriples), end(ARMebTriples)); -@@ -3528,7 +3530,8 @@ static std::string getMultiarchTriple(const Driver &D, - // regardless of what the actual target triple is. - case llvm::Triple::arm: - case llvm::Triple::thumb: -- if (TargetEnvironment == llvm::Triple::GNUEABIHF) { -+ if (TargetEnvironment == llvm::Triple::GNUEABIHF || -+ TargetEnvironment == llvm::Triple::MuslEABIHF) { - if (D.getVFS().exists(SysRoot + "/lib/arm-linux-gnueabihf")) - return "arm-linux-gnueabihf"; - } else { -@@ -3538,7 +3541,8 @@ static std::string getMultiarchTriple(const Driver &D, - break; - case llvm::Triple::armeb: - case llvm::Triple::thumbeb: -- if (TargetEnvironment == llvm::Triple::GNUEABIHF) { -+ if (TargetEnvironment == llvm::Triple::GNUEABIHF || -+ TargetEnvironment == llvm::Triple::MuslEABIHF) { - if (D.getVFS().exists(SysRoot + "/lib/armeb-linux-gnueabihf")) - return "armeb-linux-gnueabihf"; - } else { -@@ -3969,7 +3973,8 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs, - break; - case llvm::Triple::arm: - case llvm::Triple::thumb: -- if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) -+ if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF || -+ getTriple().getEnvironment() == llvm::Triple::MuslEABIHF) - MultiarchIncludeDirs = ARMHFMultiarchIncludeDirs; - else - MultiarchIncludeDirs = ARMMultiarchIncludeDirs; -diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp -index b7ac24f..ea1ce6f 100644 ---- a/lib/Driver/Tools.cpp -+++ b/lib/Driver/Tools.cpp -@@ -712,6 +712,7 @@ arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) { - case llvm::Triple::FreeBSD: - switch (Triple.getEnvironment()) { - case llvm::Triple::GNUEABIHF: -+ case llvm::Triple::MuslEABIHF: - ABI = FloatABI::Hard; - break; - default: -@@ -725,6 +726,7 @@ arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) { - switch (Triple.getEnvironment()) { - case llvm::Triple::GNUEABIHF: - case llvm::Triple::EABIHF: -+ case llvm::Triple::MuslEABIHF: - ABI = FloatABI::Hard; - break; - case llvm::Triple::GNUEABI: -@@ -968,6 +970,8 @@ void Clang::AddARMTargetArgs(const llvm::Triple &Triple, const ArgList &Args, - case llvm::Triple::Android: - case llvm::Triple::GNUEABI: - case llvm::Triple::GNUEABIHF: -+ case llvm::Triple::MuslEABI: -+ case llvm::Triple::MuslEABIHF: - ABIName = "aapcs-linux"; - break; - case llvm::Triple::EABIHF: -@@ -7857,6 +7861,8 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, - switch (getToolChain().getTriple().getEnvironment()) { - case llvm::Triple::GNUEABIHF: - case llvm::Triple::GNUEABI: -+ case llvm::Triple::MuslEABIHF: -+ case llvm::Triple::MuslEABI: - case llvm::Triple::EABI: - CmdArgs.push_back("-meabi=5"); - break; -@@ -8199,10 +8205,12 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, - switch (getToolChain().getTriple().getEnvironment()) { - case llvm::Triple::EABI: - case llvm::Triple::GNUEABI: -+ case llvm::Triple::MuslEABI: - CmdArgs.push_back("armelf_nbsd_eabi"); - break; - case llvm::Triple::EABIHF: - case llvm::Triple::GNUEABIHF: -+ case llvm::Triple::MuslEABIHF: - CmdArgs.push_back("armelf_nbsd_eabihf"); - break; - default: -@@ -8219,10 +8227,12 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, - switch (getToolChain().getTriple().getEnvironment()) { - case llvm::Triple::EABI: - case llvm::Triple::GNUEABI: -+ case llvm::Triple::MuslEABI: - CmdArgs.push_back("armelfb_nbsd_eabi"); - break; - case llvm::Triple::EABIHF: - case llvm::Triple::GNUEABIHF: -+ case llvm::Triple::MuslEABIHF: - CmdArgs.push_back("armelfb_nbsd_eabihf"); - break; - default: -@@ -8623,11 +8633,43 @@ static void AddLibgcc(const llvm::Triple &Triple, const Driver &D, - CmdArgs.push_back("-ldl"); - } - -+static std::string getMuslDynamicLinker(const llvm::Triple::ArchType Arch, -+ const llvm::Triple::EnvironmentType Env) { -+ switch (Arch) { -+ case llvm::Triple::arm: -+ case llvm::Triple::thumb: -+ return Env == llvm::Triple::MuslEABIHF ? -+ "/lib/ld-musl-armhf.so.1" : "/lib/ld-musl-arm.so.1"; -+ case llvm::Triple::armeb: -+ case llvm::Triple::thumbeb: -+ return Env == llvm::Triple::MuslEABIHF ? -+ "/lib/ld-musl-armebhf.so.1" : "/lib/ld-musl-armeb.so.1"; -+ case llvm::Triple::aarch64: -+ return "/lib/ld-musl-aarch64.so.1"; -+ case llvm::Triple::aarch64_be: -+ return "/lib/ld-musl-aarch64_be.so.1"; -+ case llvm::Triple::mips: -+ return "/lib/ld-musl-mips.so.1"; -+ case llvm::Triple::mipsel: -+ return "/lib/ld-musl-mipsel.so.1"; -+ case llvm::Triple::ppc: -+ return "/lib/ld-musl-powerpc.so.1"; -+ case llvm::Triple::x86: -+ return "/lib/ld-musl-i386.so.1"; -+//case llvm::Triple::x86_64: -+ default: -+ return "/lib/ld-musl-x86_64.so.1"; -+ } -+ return NULL; -+} -+ - static std::string getLinuxDynamicLinker(const ArgList &Args, - const toolchains::Linux &ToolChain) { - const llvm::Triple::ArchType Arch = ToolChain.getArch(); - -- if (ToolChain.getTriple().isAndroid()) { -+ if (ToolChain.getTriple().isMusl()) { -+ return getMuslDynamicLinker(Arch, ToolChain.getTriple().getEnvironment()); -+ } else if (ToolChain.getTriple().isAndroid()) { - if (ToolChain.getTriple().isArch64Bit()) - return "/system/bin/linker64"; - else --- -2.7.3 - diff --git a/patches/clang_host/clang-0005-Enable-PIE-by-default-for-alpine-linux.patch b/patches/clang_host/clang-0005-Enable-PIE-by-default-for-alpine-linux.patch deleted file mode 100644 index a1d49eeb..00000000 --- a/patches/clang_host/clang-0005-Enable-PIE-by-default-for-alpine-linux.patch +++ /dev/null @@ -1,69 +0,0 @@ -From efbdf70c883a356106fc1bcb1c2917ec6c0a6157 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Tue, 23 Feb 2016 09:35:26 +0100 -Subject: [PATCH 5/7] Enable PIE by default for alpine linux - -Alpine Linux uses PIE by default. ---- - lib/Driver/ToolChains.cpp | 5 ++++- - lib/Driver/Tools.cpp | 4 +++- - test/Driver/pic.c | 12 ++++++++++++ - 3 files changed, 19 insertions(+), 2 deletions(-) - -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 0db9644..82449bf 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -4143,7 +4143,10 @@ void Linux::AddCudaIncludeArgs(const ArgList &DriverArgs, - } - } - --bool Linux::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); } -+bool Linux::isPIEDefault() const { -+ return getSanitizerArgs().requiresPIE() || -+ Linux::getTriple().getVendorName().compare("alpine") == 0; -+} - - SanitizerMask Linux::getSupportedSanitizers() const { - const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; -diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp -index ea1ce6f..8fd3649 100644 ---- a/lib/Driver/Tools.cpp -+++ b/lib/Driver/Tools.cpp -@@ -7919,7 +7919,9 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, - if (!D.SysRoot.empty()) - CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); - -- if (IsPIE) -+ if (Args.hasArg(options::OPT_nopie)) -+ CmdArgs.push_back("-nopie"); -+ else if (IsPIE) - CmdArgs.push_back("-pie"); - - if (Args.hasArg(options::OPT_static)) { -diff --git a/test/Driver/pic.c b/test/Driver/pic.c -index aeb2ee3..9b8e0f6 100644 ---- a/test/Driver/pic.c -+++ b/test/Driver/pic.c -@@ -243,6 +243,18 @@ - // RUN: %clang %s -target i386-pc-openbsd -nopie -### 2>&1 \ - // RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD - // -+// On Alpine Linux, we want similar PIE-by-default behavior -+// RUN: %clang -c %s -target x86_64-alpine-linux-musl -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -+// RUN: %clang -c %s -target i686-alpine-linux-musl -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -+// RUN: %clang -c %s -target armv6-alpine-linux-musleabihf -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -+// RUN: %clang -c %s -target armv7-alpine-linux-musleabihf -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -+// RUN: %clang %s -target x86_64-alpine-linux-musl -nopie -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD -+// - // On Android PIC is enabled by default - // RUN: %clang -c %s -target i686-linux-android -### 2>&1 \ - // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 --- -2.7.3 - diff --git a/patches/clang_host/clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch b/patches/clang_host/clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch deleted file mode 100644 index a7ad2d8c..00000000 --- a/patches/clang_host/clang-0006-Link-with-z-now-by-default-for-Alpine-Linux.patch +++ /dev/null @@ -1,28 +0,0 @@ -From e089ab63916eada060fdfffbf7422c9b20bafe84 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Tue, 23 Feb 2016 10:08:17 +0000 -Subject: [PATCH 6/7] Link with -z now by default for Alpine Linux - ---- - lib/Driver/ToolChains.cpp | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 82449bf..1a8ebf5 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -3671,6 +3671,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - - Distro Distro = DetectDistro(D, Arch); - -+ if (Distro == AlpineLinux) { -+ ExtraOpts.push_back("-z"); -+ ExtraOpts.push_back("now"); -+ } -+ - if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) { - ExtraOpts.push_back("-z"); - ExtraOpts.push_back("relro"); --- -2.7.3 - diff --git a/patches/clang_host/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch b/patches/clang_host/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch deleted file mode 100644 index a4cb9261..00000000 --- a/patches/clang_host/clang-0007-Enable-stack-protector-by-default-for-alpine-linux.patch +++ /dev/null @@ -1,69 +0,0 @@ -From da8ea517105fff702f936695dcfae844ac85260d Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Tue, 23 Feb 2016 10:16:54 +0000 -Subject: [PATCH 7/7] Enable stack protector by default for alpine linux - ---- - lib/Driver/ToolChains.cpp | 7 +++++++ - lib/Driver/ToolChains.h | 1 + - test/Driver/stack-protector.c | 14 ++++++++++++++ - 3 files changed, 22 insertions(+) - -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 1a8ebf5..59b7601 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -4193,6 +4193,13 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args, - ToolChain::addProfileRTLibs(Args, CmdArgs); - } - -+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const { -+ StringRef VendorName = Linux::getTriple().getVendorName(); -+ if (VendorName.compare("alpine") == 0) -+ return 2; -+ return 1; -+} -+ - /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly. - - DragonFly::DragonFly(const Driver &D, const llvm::Triple &Triple, -diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h -index f940e58..977ea66 100644 ---- a/lib/Driver/ToolChains.h -+++ b/lib/Driver/ToolChains.h -@@ -796,6 +796,7 @@ public: - void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override; - bool isPIEDefault() const override; -+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override; - SanitizerMask getSupportedSanitizers() const override; - void addProfileRTLibs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const override; -diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c -index 487af56..2fbd39a 100644 ---- a/test/Driver/stack-protector.c -+++ b/test/Driver/stack-protector.c -@@ -24,6 +24,20 @@ - // SSP-ALL: "-stack-protector" "3" - // SSP-ALL-NOT: "-stack-protector-buffer-size" - -+// RUN: %clang -target x86_64-alpine-linux-musl -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE -+// ALPINE: "-stack-protector" "2" -+ -+// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_SPS -+// ALPINE_SPS: "-stack-protector" "2" -+ -+// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_ALL -+// ALPINE_ALL: "-stack-protector" "3" -+// ALPINE_ALL-NOT: "-stack-protector-buffer-size" -+ -+// RUN: %clang -target x86_64-alpine-linux-musl -fno-stack-protector -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_NOSSP -+// ALPINE_NOSSP-NOT: "-stack-protector" -+// ALPINE_NOSSP-NOT: "-stack-protector-buffer-size" -+ - // RUN: %clang -target x86_64-scei-ps4 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4 - // RUN: %clang -target x86_64-scei-ps4 -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4 - // SSP-PS4: "-stack-protector" "2" --- -2.7.3 - diff --git a/patches/clang_host/clang-0008-LLVM_PREFIX.patch b/patches/clang_host/clang-0008-LLVM_PREFIX.patch deleted file mode 100644 index 8599276c..00000000 --- a/patches/clang_host/clang-0008-LLVM_PREFIX.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- cfe-3.8.1.src/lib/Driver/CMakeLists.txt.orig 2015-07-02 04:45:27.000000000 +0000 -+++ cfe-3.8.1.src/lib/Driver/CMakeLists.txt 2017-01-19 19:22:36.869663323 +0000 -@@ -3,6 +3,8 @@ - Support - ) - -+add_definitions(-DLLVM_PREFIX="${LLVM_PREFIX}") -+ - add_clang_library(clangDriver - Action.cpp - Compilation.cpp diff --git a/patches/llvm_host/llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch b/patches/llvm_host/llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch deleted file mode 100644 index c1dfc5bd..00000000 --- a/patches/llvm_host/llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 1cec99f6d53d442d8a8c9d2ed9f4a58f8fdc6412 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 18 Feb 2016 08:30:07 +0100 -Subject: [PATCH 1/3] Add Musl, MuslEABI and Musl EABIHF triples - ---- - include/llvm/ADT/Triple.h | 11 +++++++++++ - lib/Support/Triple.cpp | 7 +++++++ - lib/Target/ARM/ARMSubtarget.h | 3 +++ - lib/Target/ARM/ARMTargetMachine.cpp | 2 ++ - 4 files changed, 23 insertions(+) - -diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h -index e01db0a..2fc4fc1 100644 ---- a/include/llvm/ADT/Triple.h -+++ b/include/llvm/ADT/Triple.h -@@ -174,6 +174,10 @@ public: - EABIHF, - Android, - -+ Musl, -+ MuslEABI, -+ MuslEABIHF, -+ - MSVC, - Itanium, - Cygnus, -@@ -544,6 +548,13 @@ public: - /// Tests whether the target is Android - bool isAndroid() const { return getEnvironment() == Triple::Android; } - -+ /// Tests whether the target is musl libc -+ bool isMusl() const { -+ return getEnvironment() == Triple::Musl || -+ getEnvironment() == Triple::MuslEABI || -+ getEnvironment() == Triple::MuslEABIHF; -+ } -+ - /// @} - /// @name Mutators - /// @{ -diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp -index 11afcf7..d90a06a 100644 ---- a/lib/Support/Triple.cpp -+++ b/lib/Support/Triple.cpp -@@ -199,6 +199,9 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { - case CODE16: return "code16"; - case EABI: return "eabi"; - case EABIHF: return "eabihf"; -+ case Musl: return "musl"; -+ case MuslEABIHF: return "muslgnueabihf"; -+ case MuslEABI: return "muslgnueabi"; - case Android: return "android"; - case MSVC: return "msvc"; - case Itanium: return "itanium"; -@@ -454,6 +457,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { - .StartsWith("code16", Triple::CODE16) - .StartsWith("gnu", Triple::GNU) - .StartsWith("android", Triple::Android) -+ .StartsWith("muslgnueabihf", Triple::MuslEABIHF) -+ .StartsWith("muslgnueabi", Triple::MuslEABI) -+ .StartsWith("musl", Triple::Musl) - .StartsWith("msvc", Triple::MSVC) - .StartsWith("itanium", Triple::Itanium) - .StartsWith("cygnus", Triple::Cygnus) -@@ -1431,6 +1437,7 @@ StringRef Triple::getARMCPUForArch(StringRef MArch) const { - switch (getEnvironment()) { - case llvm::Triple::EABIHF: - case llvm::Triple::GNUEABIHF: -+ case llvm::Triple::MuslEABIHF: - return "arm1176jzf-s"; - default: - return "arm7tdmi"; -diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h -index 4d54e57..7ed7ab7 100644 ---- a/lib/Target/ARM/ARMSubtarget.h -+++ b/lib/Target/ARM/ARMSubtarget.h -@@ -405,8 +405,10 @@ public: - bool isTargetEHABICompatible() const { - return (TargetTriple.getEnvironment() == Triple::EABI || - TargetTriple.getEnvironment() == Triple::GNUEABI || -+ TargetTriple.getEnvironment() == Triple::MuslEABI || - TargetTriple.getEnvironment() == Triple::EABIHF || - TargetTriple.getEnvironment() == Triple::GNUEABIHF || -+ TargetTriple.getEnvironment() == Triple::MuslEABIHF || - isTargetAndroid()) && - !isTargetDarwin() && !isTargetWindows(); - } -@@ -415,6 +417,7 @@ public: - // FIXME: this is invalid for WindowsCE - return TargetTriple.getEnvironment() == Triple::GNUEABIHF || - TargetTriple.getEnvironment() == Triple::EABIHF || -+ TargetTriple.getEnvironment() == Triple::MuslEABIHF || - isTargetWindows() || isAAPCS16_ABI(); - } - bool isTargetAndroid() const { return TargetTriple.isAndroid(); } -diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp -index fca1901..25f5cf9 100644 ---- a/lib/Target/ARM/ARMTargetMachine.cpp -+++ b/lib/Target/ARM/ARMTargetMachine.cpp -@@ -101,6 +101,8 @@ computeTargetABI(const Triple &TT, StringRef CPU, - case llvm::Triple::GNUEABIHF: - case llvm::Triple::EABIHF: - case llvm::Triple::EABI: -+ case llvm::Triple::MuslEABI: -+ case llvm::Triple::MuslEABIHF: - TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS; - break; - case llvm::Triple::GNU: --- -2.7.3 - diff --git a/patches/llvm_host/llvm-0002-Fix-build-with-musl-libc.patch b/patches/llvm_host/llvm-0002-Fix-build-with-musl-libc.patch deleted file mode 100644 index 1a690808..00000000 --- a/patches/llvm_host/llvm-0002-Fix-build-with-musl-libc.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 5c571082fdaf61f6df19d9b7137dc26d71334058 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 18 Feb 2016 10:33:04 +0100 -Subject: [PATCH 2/3] Fix build with musl libc - -On musl libc the fopen64 and fopen are the same thing, but for -compatibility they have a `#define fopen64 fopen`. Same applies for -fseek64, fstat64, fstatvfs64, ftello64, lstat64, stat64 and tmpfile64. ---- - include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h -index 7becdf0..7f14427 100644 ---- a/include/llvm/Analysis/TargetLibraryInfo.h -+++ b/include/llvm/Analysis/TargetLibraryInfo.h -@@ -18,6 +18,15 @@ - #include "llvm/IR/Module.h" - #include "llvm/Pass.h" - -+#undef fopen64 -+#undef fseeko64 -+#undef fstat64 -+#undef fstatvfs64 -+#undef ftello64 -+#undef lstat64 -+#undef stat64 -+#undef tmpfile64 -+ - namespace llvm { - /// VecDesc - Describes a possible vectorization of a function. - /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized --- -2.7.3 - diff --git a/patches/llvm_host/llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch b/patches/llvm_host/llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch deleted file mode 100644 index d5d7f07b..00000000 --- a/patches/llvm_host/llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d12ecb83d01dcb580dd94f4d57828f33d3eb4c35 Mon Sep 17 00:00:00 2001 -From: Natanael Copa <ncopa@alpinelinux.org> -Date: Thu, 18 Feb 2016 15:33:21 +0100 -Subject: [PATCH 3/3] Fix DynamicLibrary to build with musl libc - -stdin/out/err is part of the libc and not the kernel so we check for the -specific libc that does the unexpected instead of linux. - -This is needed for making it build with musl libc. ---- - lib/Support/DynamicLibrary.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp -index 9a7aeb5..0c1c8f8 100644 ---- a/lib/Support/DynamicLibrary.cpp -+++ b/lib/Support/DynamicLibrary.cpp -@@ -140,10 +140,10 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { - #define EXPLICIT_SYMBOL(SYM) \ - if (!strcmp(symbolName, #SYM)) return &SYM - --// On linux we have a weird situation. The stderr/out/in symbols are both -+// On GNU libc we have a weird situation. The stderr/out/in symbols are both - // macros and global variables because of standards requirements. So, we - // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. --#if defined(__linux__) and !defined(__ANDROID__) -+#if defined(__GLIBC__) - { - EXPLICIT_SYMBOL(stderr); - EXPLICIT_SYMBOL(stdout); --- -2.7.3 - diff --git a/patches/llvm_host/llvm-0004-Fix-ScalarEvolutionExpander-step-scaling-bug.patch b/patches/llvm_host/llvm-0004-Fix-ScalarEvolutionExpander-step-scaling-bug.patch deleted file mode 100644 index 9945bf35..00000000 --- a/patches/llvm_host/llvm-0004-Fix-ScalarEvolutionExpander-step-scaling-bug.patch +++ /dev/null @@ -1,99 +0,0 @@ -From c8ce9e59a883f452bc538b5f16fb83649472dc3e Mon Sep 17 00:00:00 2001 -From: Keno Fischer <kfischer@college.harvard.edu> -Date: Wed, 13 Jul 2016 01:28:12 +0000 -Subject: [PATCH] Fix ScalarEvolutionExpander step scaling bug - -The expandAddRecExprLiterally function incorrectly transforms -`[Start + Step * X]` into `Step * [Start + X]` instead of the correct -transform of `[Step * X] + Start`. - -This caused https://github.com/JuliaLang/julia/issues/14704#issuecomment-174126219 -due to what appeared to be sufficiently complicated loop interactions. - -Patch by Jameson Nash (jameson@juliacomputing.com). - -Reviewers: sanjoy -Differential Revision: http://reviews.llvm.org/D16505 - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275239 91177308-0d34-0410-b5e6-96231b3b80d8 - -Alpine maintainer notes: -This patch replaces deps/patches/llvm-3.7.1_3.patch from Julia. ---- - lib/Analysis/ScalarEvolutionExpander.cpp | 7 ++++ - .../ScalarEvolution/incorrect-offset-scaling.ll | 48 ++++++++++++++++++++++ - 2 files changed, 55 insertions(+) - create mode 100644 test/Analysis/ScalarEvolution/incorrect-offset-scaling.ll - -diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp -index 7716435..77e4ec7 100644 ---- a/lib/Analysis/ScalarEvolutionExpander.cpp -+++ b/lib/Analysis/ScalarEvolutionExpander.cpp -@@ -1288,6 +1288,13 @@ Value *SCEVExpander::expandAddRecExprLiterally(const SCEVAddRecExpr *S) { - if (!SE.dominates(Step, L->getHeader())) { - PostLoopScale = Step; - Step = SE.getConstant(Normalized->getType(), 1); -+ if (!Start->isZero()) { -+ // The normalization below assumes that Start is constant zero, so if -+ // it isn't re-associate Start to PostLoopOffset. -+ assert(!PostLoopOffset && "Start not-null but PostLoopOffset set?"); -+ PostLoopOffset = Start; -+ Start = SE.getConstant(Normalized->getType(), 0); -+ } - Normalized = - cast<SCEVAddRecExpr>(SE.getAddRecExpr( - Start, Step, Normalized->getLoop(), -diff --git a/test/Analysis/ScalarEvolution/incorrect-offset-scaling.ll b/test/Analysis/ScalarEvolution/incorrect-offset-scaling.ll -new file mode 100644 -index 0000000..7ffb093 ---- /dev/null -+++ b/test/Analysis/ScalarEvolution/incorrect-offset-scaling.ll -@@ -0,0 +1,48 @@ -+; RUN: opt -S -loop-reduce < %s | FileCheck %s -+ -+target triple = "x86_64-unknown-unknown" -+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -+ -+define void @incorrect_offset_scaling(i64, i64*) { -+top: -+ br label %L -+ -+L: ; preds = %idxend.10, %idxend, %L2, %top -+ br i1 undef, label %L, label %L1 -+ -+L1: ; preds = %L1.preheader, %L2 -+ %r13 = phi i64 [ %r1, %L2 ], [ 1, %L ] -+; CHECK: %lsr.iv = phi i64 [ 0, %L{{[^ ]+}} ], [ %lsr.iv.next, %L2 ] -+; CHECK-NOT: %lsr.iv = phi i64 [ -1, %L{{[^ ]+}} ], [ %lsr.iv.next, %L2 ] -+; CHECK: br -+ %r0 = add i64 %r13, -1 -+ br label %idxend.8 -+ -+L2: ; preds = %idxend.8 -+ %r1 = add i64 %r13, 1 -+ br i1 undef, label %L, label %L1 -+ -+if6: ; preds = %idxend.8 -+ %r2 = add i64 %0, -1 -+ %r3 = load i64, i64* %1, align 8 -+; CHECK-NOT: %r2 -+; CHECK: %r3 = load i64 -+ br label %ib -+ -+idxend.8: ; preds = %L1 -+ br i1 undef, label %if6, label %L2 -+ -+ib: ; preds = %if6 -+ %r4 = mul i64 %r3, %r0 -+ %r5 = add i64 %r2, %r4 -+ %r6 = icmp ult i64 %r5, undef -+; CHECK %2 = mul i64 %lsr.iv, %r3 -+; CHECK %3 = add i64 %1, -1 -+; CHECK %4 = add i64 %0, %r3 -+; CHECK %r6 -+ %r7 = getelementptr i64, i64* undef, i64 %r5 -+ store i64 1, i64* %r7, align 8 -+; CHECK %5 = mul i64 %lsr.iv, %r3 -+; CHECK %6 = add i64 %5, -1 -+ br label %L -+} diff --git a/patches/llvm_host/llvm-0005-optimize-store-of-bitcast-from-vector-to-aggregate.patch b/patches/llvm_host/llvm-0005-optimize-store-of-bitcast-from-vector-to-aggregate.patch deleted file mode 100644 index 7f891b66..00000000 --- a/patches/llvm_host/llvm-0005-optimize-store-of-bitcast-from-vector-to-aggregate.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 1ca1fcaa5b4c75a65a202badfd5df8240a36ca0f Mon Sep 17 00:00:00 2001 -From: "Arch D. Robison" <arch.robison@intel.com> -Date: Mon, 25 Apr 2016 22:22:39 +0000 -Subject: [PATCH] Optimize store of "bitcast" from vector to aggregate. - -This patch is what was the "instcombine" portion of D14185, with an additional -test added (see julia_pseudovec in test/Transforms/InstCombine/insert-val-extract-elem.ll). -The patch causes instcombine to replace sequences of extractelement-insertvalue-store -that act essentially like a bitcast followed by a store. - -Differential review: http://reviews.llvm.org/D14260 - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267482 91177308-0d34-0410-b5e6-96231b3b80d8 - -Alpine maintainer notes: - - Updated for llvm 3.8.1. - - This patch replaces llvm-D14260.patch from Julia. ---- - .../InstCombine/InstCombineLoadStoreAlloca.cpp | 60 ++++++++++++++++++ - .../InstCombine/insert-val-extract-elem.ll | 74 ++++++++++++++++++++++ - 2 files changed, 134 insertions(+) - create mode 100644 test/Transforms/InstCombine/insert-val-extract-elem.ll - -diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -index 96f0908..0ee6045 100644 ---- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -+++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -@@ -913,6 +913,61 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { - return nullptr; - } - -+/// \brief Look for extractelement/insertvalue sequence that acts like a bitcast. -+/// -+/// \returns underlying value that was "cast", or nullptr otherwise. -+/// -+/// For example, if we have: -+/// -+/// %E0 = extractelement <2 x double> %U, i32 0 -+/// %V0 = insertvalue [2 x double] undef, double %E0, 0 -+/// %E1 = extractelement <2 x double> %U, i32 1 -+/// %V1 = insertvalue [2 x double] %V0, double %E1, 1 -+/// -+/// and the layout of a <2 x double> is isomorphic to a [2 x double], -+/// then %V1 can be safely approximated by a conceptual "bitcast" of %U. -+/// Note that %U may contain non-undef values where %V1 has undef. -+static Value *likeBitCastFromVector(InstCombiner &IC, Value *V) { -+ Value *U = nullptr; -+ while (auto *IV = dyn_cast<InsertValueInst>(V)) { -+ auto *E = dyn_cast<ExtractElementInst>(IV->getInsertedValueOperand()); -+ if (!E) -+ return nullptr; -+ auto *W = E->getVectorOperand(); -+ if (!U) -+ U = W; -+ else if (U != W) -+ return nullptr; -+ auto *CI = dyn_cast<ConstantInt>(E->getIndexOperand()); -+ if (!CI || IV->getNumIndices() != 1 || CI->getZExtValue() != *IV->idx_begin()) -+ return nullptr; -+ V = IV->getAggregateOperand(); -+ } -+ if (!isa<UndefValue>(V) ||!U) -+ return nullptr; -+ -+ auto *UT = cast<VectorType>(U->getType()); -+ auto *VT = V->getType(); -+ // Check that types UT and VT are bitwise isomorphic. -+ const auto &DL = IC.getDataLayout(); -+ if (DL.getTypeStoreSizeInBits(UT) != DL.getTypeStoreSizeInBits(VT)) { -+ return nullptr; -+ } -+ if (auto *AT = dyn_cast<ArrayType>(VT)) { -+ if (AT->getNumElements() != UT->getNumElements()) -+ return nullptr; -+ } else { -+ auto *ST = cast<StructType>(VT); -+ if (ST->getNumElements() != UT->getNumElements()) -+ return nullptr; -+ for (const auto *EltT : ST->elements()) { -+ if (EltT != UT->getElementType()) -+ return nullptr; -+ } -+ } -+ return U; -+} -+ - /// \brief Combine stores to match the type of value being stored. - /// - /// The core idea here is that the memory does not have any intrinsic type and -@@ -924,6 +979,11 @@ - return true; - } - -+ if (Value *U = likeBitCastFromVector(IC, V)) { -+ combineStoreToNewValue(IC, SI, U); -+ return true; -+ } -+ - // FIXME: We should also canonicalize loads of vectors when their elements are - // cast to other types. - return false; -diff --git a/test/Transforms/InstCombine/insert-val-extract-elem.ll b/test/Transforms/InstCombine/insert-val-extract-elem.ll -new file mode 100644 -index 0000000..db7b403 ---- /dev/null -+++ b/test/Transforms/InstCombine/insert-val-extract-elem.ll -@@ -0,0 +1,74 @@ -+; RUN: opt -S -instcombine %s | FileCheck %s -+ -+; CHECK-LABEL: julia_2xdouble -+; CHECK-NOT: insertvalue -+; CHECK-NOT: extractelement -+; CHECK: store <2 x double> -+define void @julia_2xdouble([2 x double]* sret, <2 x double>*) { -+top: -+ %x = load <2 x double>, <2 x double>* %1 -+ %x0 = extractelement <2 x double> %x, i32 0 -+ %i0 = insertvalue [2 x double] undef, double %x0, 0 -+ %x1 = extractelement <2 x double> %x, i32 1 -+ %i1 = insertvalue [2 x double] %i0, double %x1, 1 -+ store [2 x double] %i1, [2 x double]* %0, align 4 -+ ret void -+} -+ -+; Test with two inserts to the same index -+; CHECK-LABEL: julia_2xi64 -+; CHECK-NOT: insertvalue -+; CHECK-NOT: extractelement -+; CHECK: store <2 x i64> -+define void @julia_2xi64([2 x i64]* sret, <2 x i64>*) { -+top: -+ %x = load <2 x i64>, <2 x i64>* %1 -+ %x0 = extractelement <2 x i64> %x, i32 1 -+ %i0 = insertvalue [2 x i64] undef, i64 %x0, 0 -+ %x1 = extractelement <2 x i64> %x, i32 1 -+ %i1 = insertvalue [2 x i64] %i0, i64 %x1, 1 -+ %x2 = extractelement <2 x i64> %x, i32 0 -+ %i2 = insertvalue [2 x i64] %i1, i64 %x2, 0 -+ store [2 x i64] %i2, [2 x i64]* %0, align 4 -+ ret void -+} -+ -+; CHECK-LABEL: julia_4xfloat -+; CHECK-NOT: insertvalue -+; CHECK-NOT: extractelement -+; CHECK: store <4 x float> -+define void @julia_4xfloat([4 x float]* sret, <4 x float>*) { -+top: -+ %x = load <4 x float>, <4 x float>* %1 -+ %x0 = extractelement <4 x float> %x, i32 0 -+ %i0 = insertvalue [4 x float] undef, float %x0, 0 -+ %x1 = extractelement <4 x float> %x, i32 1 -+ %i1 = insertvalue [4 x float] %i0, float %x1, 1 -+ %x2 = extractelement <4 x float> %x, i32 2 -+ %i2 = insertvalue [4 x float] %i1, float %x2, 2 -+ %x3 = extractelement <4 x float> %x, i32 3 -+ %i3 = insertvalue [4 x float] %i2, float %x3, 3 -+ store [4 x float] %i3, [4 x float]* %0, align 4 -+ ret void -+} -+ -+%pseudovec = type { float, float, float, float } -+ -+; CHECK-LABEL: julia_pseudovec -+; CHECK-NOT: insertvalue -+; CHECK-NOT: extractelement -+; CHECK: store <4 x float> -+define void @julia_pseudovec(%pseudovec* sret, <4 x float>*) { -+top: -+ %x = load <4 x float>, <4 x float>* %1 -+ %x0 = extractelement <4 x float> %x, i32 0 -+ %i0 = insertvalue %pseudovec undef, float %x0, 0 -+ %x1 = extractelement <4 x float> %x, i32 1 -+ %i1 = insertvalue %pseudovec %i0, float %x1, 1 -+ %x2 = extractelement <4 x float> %x, i32 2 -+ %i2 = insertvalue %pseudovec %i1, float %x2, 2 -+ %x3 = extractelement <4 x float> %x, i32 3 -+ %i3 = insertvalue %pseudovec %i2, float %x3, 3 -+ store %pseudovec %i3, %pseudovec* %0, align 4 -+ ret void -+} diff --git a/patches/llvm_host/llvm-0006-clone-every-functions-debug-info.patch b/patches/llvm_host/llvm-0006-clone-every-functions-debug-info.patch deleted file mode 100644 index 567ddcad..00000000 --- a/patches/llvm_host/llvm-0006-clone-every-functions-debug-info.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 11adcc4de0797c83e61ae0240927f0bafcf041a9 Mon Sep 17 00:00:00 2001 -From: Keno Fischer <kfischer@college.harvard.edu> -Date: Sat, 13 Feb 2016 02:04:29 +0000 -Subject: [PATCH] [Cloning] Clone every Function's Debug Info - -Summary: -Export the CloneDebugInfoMetadata utility, which clones all debug info -associated with a function into the first module. Also use this function -in CloneModule on each function we clone (the CloneFunction entrypoint -already does this). - -Without this, cloning a module will lead to DI quality regressions, -especially since r252219 reversed the Function <-> DISubprogram edge -(before we could get lucky and have this edge preserved if the -DISubprogram itself was, e.g. due to location metadata). - -This was verified to fix missing debug information in julia and -a unittest to verify the new behavior is included. - -Patch by Yichao Yu! Thanks! - -Reviewers: loladiro, pcc -Differential Revision: http://reviews.llvm.org/D17165 - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260791 91177308-0d34-0410-b5e6-96231b3b80d8 - -Alpine maintainer notes: - - Corresponds to llvm-D17165-D18583.patch in Julia. ---- - include/llvm/Transforms/Utils/Cloning.h | 5 +++++ - lib/Transforms/Utils/CloneFunction.cpp | 4 ++-- - lib/Transforms/Utils/CloneModule.cpp | 1 + - unittests/Transforms/Utils/Cloning.cpp | 25 +++++++++++++++++++++++++ - 4 files changed, 33 insertions(+), 2 deletions(-) - -diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h -index 4f006f2..0bae2bd 100644 ---- a/include/llvm/Transforms/Utils/Cloning.h -+++ b/include/llvm/Transforms/Utils/Cloning.h -@@ -130,6 +130,11 @@ Function *CloneFunction(const Function *F, ValueToValueMapTy &VMap, - bool ModuleLevelChanges, - ClonedCodeInfo *CodeInfo = nullptr); - -+/// Clone the module-level debug info associated with OldFunc. The cloned data -+/// will point to NewFunc instead. -+void CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc, -+ ValueToValueMapTy &VMap); -+ - /// Clone OldFunc into NewFunc, transforming the old arguments into references - /// to VMap values. Note that if NewFunc already has basic blocks, the ones - /// cloned into it will be added to the end of the function. This function -diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp -index 6454afb..8b5692a 100644 ---- a/lib/Transforms/Utils/CloneFunction.cpp -+++ b/lib/Transforms/Utils/CloneFunction.cpp -@@ -187,8 +187,8 @@ static void AddOperand(DICompileUnit *CU, DISubprogramArray SPs, - - // Clone the module-level debug info associated with OldFunc. The cloned data - // will point to NewFunc instead. --static void CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc, -- ValueToValueMapTy &VMap) { -+void llvm::CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc, -+ ValueToValueMapTy &VMap) { - DebugInfoFinder Finder; - Finder.processModule(*OldFunc->getParent()); - -diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp -index 53de62a..b16a02a 100644 ---- a/lib/Transforms/Utils/CloneModule.cpp -+++ b/lib/Transforms/Utils/CloneModule.cpp -@@ -136,6 +136,7 @@ std::unique_ptr<Module> llvm::CloneModule( - VMap[&*J] = &*DestI++; - } - -+ CloneDebugInfoMetadata(F, &*I, VMap); - SmallVector<ReturnInst*, 8> Returns; // Ignore returns cloned. - CloneFunctionInto(F, &*I, VMap, /*ModuleLevelChanges=*/true, Returns); - } -diff --git a/unittests/Transforms/Utils/Cloning.cpp b/unittests/Transforms/Utils/Cloning.cpp -index 25e322e..b761e4e 100644 ---- a/unittests/Transforms/Utils/Cloning.cpp -+++ b/unittests/Transforms/Utils/Cloning.cpp -@@ -423,6 +423,7 @@ class CloneModule : public ::testing::Test { - void SetupModule() { OldM = new Module("", C); } - - void CreateOldModule() { -+ DIBuilder DBuilder(*OldM); - IRBuilder<> IBuilder(C); - - auto *FuncType = FunctionType::get(Type::getVoidTy(C), false); -@@ -431,9 +432,25 @@ class CloneModule : public ::testing::Test { - auto *F = - Function::Create(FuncType, GlobalValue::PrivateLinkage, "f", OldM); - F->setPersonalityFn(PersFn); -+ -+ // Create debug info -+ auto *File = DBuilder.createFile("filename.c", "/file/dir/"); -+ DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None); -+ DISubroutineType *DFuncType = DBuilder.createSubroutineType(ParamTypes); -+ auto *CU = -+ DBuilder.createCompileUnit(dwarf::DW_LANG_C99, "filename.c", -+ "/file/dir", "CloneModule", false, "", 0); -+ // Function DI -+ auto *Subprogram = DBuilder.createFunction(CU, "f", "f", File, 4, DFuncType, -+ true, true, 3, 0, false); -+ F->setSubprogram(Subprogram); -+ - auto *Entry = BasicBlock::Create(C, "", F); - IBuilder.SetInsertPoint(Entry); - IBuilder.CreateRetVoid(); -+ -+ // Finalize the debug info -+ DBuilder.finalize(); - } - - void CreateNewModule() { NewM = llvm::CloneModule(OldM).release(); } -@@ -447,4 +464,12 @@ TEST_F(CloneModule, Verify) { - EXPECT_FALSE(verifyModule(*NewM)); - } - -+TEST_F(CloneModule, Subprogram) { -+ Function *NewF = NewM->getFunction("f"); -+ DISubprogram *SP = NewF->getSubprogram(); -+ EXPECT_TRUE(SP != nullptr); -+ EXPECT_EQ(SP->getName(), "f"); -+ EXPECT_EQ(SP->getFile()->getFilename(), "filename.c"); -+ EXPECT_EQ(SP->getLine(), (unsigned)4); -+} - } diff --git a/patches/llvm_host/llvm-0007-reduce-complexity-of-debug-info-clonning-and-fix-correctness.patch b/patches/llvm_host/llvm-0007-reduce-complexity-of-debug-info-clonning-and-fix-correctness.patch deleted file mode 100644 index 0930c28e..00000000 --- a/patches/llvm_host/llvm-0007-reduce-complexity-of-debug-info-clonning-and-fix-correctness.patch +++ /dev/null @@ -1,102 +0,0 @@ -From af289e04413504c3bdc252e08c3fe17bf7ea6dc8 Mon Sep 17 00:00:00 2001 -From: Peter Collingbourne <peter@pcc.me.uk> -Date: Wed, 30 Mar 2016 22:05:13 +0000 -Subject: [PATCH] Cloning: Reduce complexity of debug info cloning and fix - correctness issue. - -Commit r260791 contained an error in that it would introduce a cross-module -reference in the old module. It also introduced O(N^2) complexity in the -module cloner by requiring the entire module to be visited for each function. -Fix both of these problems by avoiding use of the CloneDebugInfoMetadata -function (which is only designed to do intra-module cloning) and cloning -function-attached metadata in the same way that we clone all other metadata. - -Differential Revision: http://reviews.llvm.org/D18583 - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264935 91177308-0d34-0410-b5e6-96231b3b80d8 - -Alpine maintainer notes: - - Corresponds to llvm-D17165-D18583.patch in Julia. ---- - include/llvm/Transforms/Utils/Cloning.h | 5 ----- - lib/Transforms/Utils/CloneFunction.cpp | 13 +++++++++++-- - lib/Transforms/Utils/CloneModule.cpp | 1 - - unittests/Transforms/Utils/Cloning.cpp | 6 ++++++ - 4 files changed, 17 insertions(+), 8 deletions(-) - -diff --git a/include/llvm/Transforms/Utils/Cloning.h b/include/llvm/Transforms/Utils/Cloning.h -index 0bae2bd..4f006f2 100644 ---- a/include/llvm/Transforms/Utils/Cloning.h -+++ b/include/llvm/Transforms/Utils/Cloning.h -@@ -130,11 +130,6 @@ Function *CloneFunction(const Function *F, ValueToValueMapTy &VMap, - bool ModuleLevelChanges, - ClonedCodeInfo *CodeInfo = nullptr); - --/// Clone the module-level debug info associated with OldFunc. The cloned data --/// will point to NewFunc instead. --void CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc, -- ValueToValueMapTy &VMap); -- - /// Clone OldFunc into NewFunc, transforming the old arguments into references - /// to VMap values. Note that if NewFunc already has basic blocks, the ones - /// cloned into it will be added to the end of the function. This function -diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp -index 05b0a17..8e1715a 100644 ---- a/lib/Transforms/Utils/CloneFunction.cpp -+++ b/lib/Transforms/Utils/CloneFunction.cpp -@@ -119,6 +119,15 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, - .addAttributes(NewFunc->getContext(), AttributeSet::FunctionIndex, - OldAttrs.getFnAttributes())); - -+ SmallVector<std::pair<unsigned, MDNode *>, 1> MDs; -+ OldFunc->getAllMetadata(MDs); -+ for (auto MD : MDs) -+ NewFunc->setMetadata( -+ MD.first, -+ MapMetadata(MD.second, VMap, -+ ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges, -+ TypeMapper, Materializer)); -+ - // Loop over all of the basic blocks in the function, cloning them as - // appropriate. Note that we save BE this way in order to handle cloning of - // recursive functions into themselves. -@@ -187,8 +196,8 @@ static void AddOperand(DICompileUnit *CU, DISubprogramArray SPs, - - // Clone the module-level debug info associated with OldFunc. The cloned data - // will point to NewFunc instead. --void llvm::CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc, -- ValueToValueMapTy &VMap) { -+static void CloneDebugInfoMetadata(Function *NewFunc, const Function *OldFunc, -+ ValueToValueMapTy &VMap) { - DebugInfoFinder Finder; - Finder.processModule(*OldFunc->getParent()); - -diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp -index 494e275..929f51b 100644 ---- a/lib/Transforms/Utils/CloneModule.cpp -+++ b/lib/Transforms/Utils/CloneModule.cpp -@@ -138,7 +138,6 @@ std::unique_ptr<Module> llvm::CloneModule( - VMap[&*J] = &*DestI++; - } - -- CloneDebugInfoMetadata(F, &*I, VMap); - SmallVector<ReturnInst*, 8> Returns; // Ignore returns cloned. - CloneFunctionInto(F, &*I, VMap, /*ModuleLevelChanges=*/true, Returns); - } -diff --git a/unittests/Transforms/Utils/Cloning.cpp b/unittests/Transforms/Utils/Cloning.cpp -index b761e4e..f06a20f 100644 ---- a/unittests/Transforms/Utils/Cloning.cpp -+++ b/unittests/Transforms/Utils/Cloning.cpp -@@ -464,6 +464,12 @@ TEST_F(CloneModule, Verify) { - EXPECT_FALSE(verifyModule(*NewM)); - } - -+TEST_F(CloneModule, OldModuleUnchanged) { -+ DebugInfoFinder Finder; -+ Finder.processModule(*OldM); -+ EXPECT_EQ(1U, Finder.subprogram_count()); -+} -+ - TEST_F(CloneModule, Subprogram) { - Function *NewF = NewM->getFunction("f"); - DISubprogram *SP = NewF->getSubprogram(); diff --git a/patches/llvm_host/llvm-0008-dont-widen-metadata-on-store-to-load-forwarding.patch b/patches/llvm_host/llvm-0008-dont-widen-metadata-on-store-to-load-forwarding.patch deleted file mode 100644 index b66584dc..00000000 --- a/patches/llvm_host/llvm-0008-dont-widen-metadata-on-store-to-load-forwarding.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 3c80c2658022201214241e9229ac35097cc476d2 Mon Sep 17 00:00:00 2001 -From: Eli Friedman <eli.friedman@gmail.com> -Date: Thu, 16 Jun 2016 02:33:42 +0000 -Subject: [PATCH] [InstCombine] Don't widen metadata on store-to-load - forwarding - -The original check for load CSE or store-to-load forwarding is wrong -when the forwarded stored value happened to be a load. - -Ref https://github.com/JuliaLang/julia/issues/16894 - -Differential Revision: http://reviews.llvm.org/D21271 - -Patch by Yichao Yu! - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272868 91177308-0d34-0410-b5e6-96231b3b80d8 - -Alpine maintainer notes: - - Updated for llvm 3.8.1. - - Corresponds to llvm-D21271-instcombine-tbaa-3.8.patch in Julia. ---- - include/llvm/Analysis/Loads.h | 3 ++- - lib/Analysis/Loads.cpp | 5 ++++- - .../InstCombine/InstCombineLoadStoreAlloca.cpp | 6 ++++-- - test/Transforms/InstCombine/tbaa-store-to-load.ll | 17 +++++++++++++++++ - 4 files changed, 27 insertions(+), 4 deletions(-) - create mode 100644 test/Transforms/InstCombine/tbaa-store-to-load.ll - -diff --git a/include/llvm/Analysis/Loads.h b/include/llvm/Analysis/Loads.h -index e5bd0c8..9d24b7b 100644 ---- a/include/llvm/Analysis/Loads.h -+++ b/include/llvm/Analysis/Loads.h -@@ -82,7 +82,8 @@ Value *FindAvailableLoadedValue(LoadInst *Load, BasicBlock *ScanBB, - BasicBlock::iterator &ScanFrom, - unsigned MaxInstsToScan = DefMaxInstsToScan, - AliasAnalysis *AA = nullptr, -- AAMDNodes *AATags = nullptr); -+ AAMDNodes *AATags = nullptr, -+ bool *IsLoadCSE = nullptr); - - } - -diff --git a/lib/Analysis/Loads.cpp b/lib/Analysis/Loads.cpp -index dce243c..7d3fd59 100644 ---- a/lib/Analysis/Loads.cpp -+++ b/lib/Analysis/Loads.cpp -@@ -322,7 +322,8 @@ llvm::DefMaxInstsToScan("available-load-scan-limit", cl::init(6), cl::Hidden, - Value *llvm::FindAvailableLoadedValue(LoadInst *Load, BasicBlock *ScanBB, - BasicBlock::iterator &ScanFrom, - unsigned MaxInstsToScan, -- AliasAnalysis *AA, AAMDNodes *AATags) { -+ AliasAnalysis *AA, AAMDNodes *AATags, -+ bool *IsLoadCSE) { - if (MaxInstsToScan == 0) - MaxInstsToScan = ~0U; - -@@ -374,6 +375,8 @@ Value *llvm::FindAvailableLoadedValue(LoadInst *Load, BasicBlock *ScanBB, - - if (AATags) - LI->getAAMetadata(*AATags); -+ if (IsLoadCSE) -+ *IsLoadCSE = true; - return LI; - } - -diff --git a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -index 6a5d5a6..d312983 100644 ---- a/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -+++ b/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp -@@ -800,10 +800,12 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { - // separated by a few arithmetic operations. - BasicBlock::iterator BBI(LI); - AAMDNodes AATags; -+ bool IsLoadCSE = false; - if (Value *AvailableVal = - FindAvailableLoadedValue(Op, LI.getParent(), BBI, -- DefMaxInstsToScan, AA, &AATags)) { -- if (LoadInst *NLI = dyn_cast<LoadInst>(AvailableVal)) { -+ DefMaxInstsToScan, AA, &AATags, &IsLoadCSE)) { -+ if (IsLoadCSE) { -+ LoadInst *NLI = cast<LoadInst>(AvailableVal); - unsigned KnownIDs[] = { - LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope, - LLVMContext::MD_noalias, LLVMContext::MD_range, -diff --git a/test/Transforms/InstCombine/tbaa-store-to-load.ll b/test/Transforms/InstCombine/tbaa-store-to-load.ll -new file mode 100644 -index 0000000..707be73 ---- /dev/null -+++ b/test/Transforms/InstCombine/tbaa-store-to-load.ll -@@ -0,0 +1,17 @@ -+; RUN: opt -S -instcombine < %s 2>&1 | FileCheck %s -+ -+define i64 @f(i64* %p1, i64* %p2) { -+top: -+ ; check that the tbaa is preserved -+ ; CHECK-LABEL: @f( -+ ; CHECK: %v1 = load i64, i64* %p1, align 8, !tbaa !0 -+ ; CHECK: store i64 %v1, i64* %p2, align 8 -+ ; CHECK: ret i64 %v1 -+ %v1 = load i64, i64* %p1, align 8, !tbaa !0 -+ store i64 %v1, i64* %p2, align 8 -+ %v2 = load i64, i64* %p2, align 8 -+ ret i64 %v2 -+} -+ -+!0 = !{!1, !1, i64 0} -+!1 = !{!"load_tbaa"} diff --git a/patches/llvm_host/llvm-0009-nm-workaround.patch b/patches/llvm_host/llvm-0009-nm-workaround.patch deleted file mode 100644 index 5755e57f..00000000 --- a/patches/llvm_host/llvm-0009-nm-workaround.patch +++ /dev/null @@ -1,27 +0,0 @@ -From https://llvm.org/bugs/show_bug.cgi?id=24115 - -diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp -index e7ee312..b9e4779 100644 ---- a/tools/llvm-nm/llvm-nm.cpp -+++ b/tools/llvm-nm/llvm-nm.cpp -@@ -486,7 +486,7 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName, - std::string ArchiveName, - std::string ArchitectureName) { - if (!NoSort) { -- std::function<bool(const NMSymbol &, const NMSymbol &)> Cmp; -+ bool (*Cmp)(const NMSymbol &, const NMSymbol &); - if (NumericSort) - Cmp = compareSymbolAddress; - else if (SizeSort) -@@ -495,8 +495,9 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName, - Cmp = compareSymbolName; - - if (ReverseSort) -- Cmp = [=](const NMSymbol &A, const NMSymbol &B) { return Cmp(B, A); }; -- std::sort(SymbolList.begin(), SymbolList.end(), Cmp); -+ std::sort(SymbolList.begin(), SymbolList.end(), [=](const NMSymbol &A, const NMSymbol &B) { return Cmp(B, A); }); -+ else -+ std::sort(SymbolList.begin(), SymbolList.end(), Cmp); - } - - if (!PrintFileName) { |