From nobody Sun Apr 09 21:35:21 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pvlkz0BKwz44JXf; Sun, 9 Apr 2023 21:35:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pvlky2pYRz4MDG; Sun, 9 Apr 2023 21:35:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681076122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mvbiJTs7BDbNGP/KF0GvvMZyghid4AnTJsFBSWqBs4A=; b=Wj28eQpo1OIkXSw8cdnWo6AnVYkEdwKKiXcZfiNRpzlHtzFNWBixtYg04FkXOZ678UuC/3 GJVKDB0iJtizhXTaFXeDOwAY9yppEiLAfF5IQ/ypGWwPvsL/9PhgWOAnq2CVJb1LtNnoqH aWz9xOl/jzRZMwTc5YyOK6WyjQ15k1YeisE1yZ9n09Ascftk1pBFnSzBxB65+l5mFC+FBx +xlGdsnAIYiVXlhjjdrt5sY3vOQgcqtLOzYeCJOnboizqXLTFOSasXMam9YZceiyY1SLv/ fnsbY8RIPB7IK7XFtBjZi/siwL5kFdbYPgqJRZ3ktNj9pJdU2P4otbhyggk1Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681076122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mvbiJTs7BDbNGP/KF0GvvMZyghid4AnTJsFBSWqBs4A=; b=XJSK6RAmTpigvtRbolHfOflxEOW7+xW/9eqlb8rO6SAQRyyYCYnvf8Cr259hjoD5MuequC ZI0tSluL5T3WC4UG7M3ThlRCmJh9oX7m92pRDaXnb5a8np2hYo9gxe7XOF0UYHpu7zVZ1+ 2R6eNCnTrUolpJhpMvSqdS4TPmZkE76WomUrG8lRufWQjtx8SrsUbqQWopZQ5lhQc1Gu/u tKZ7dz1TvwdUtkZEnGqUJYUett7SYzN089MSwcdf31SbAVMLWBgOLbCcse7WltKlNoRN8x GGwuLwW8hAb0Tsuk1jIkwplyZpfFvMqTv6N4FAOoiSi3utWPZFmumx1IEiBV7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681076122; a=rsa-sha256; cv=none; b=pci1TyZF41DYI2dMLGkwYBe7rBecrIxDB4CLpkaz/x3C8onE5baA9OGezQLHfxhIktVS3u mvO/UjOUVnlvg3ZI5FwebtKs3sfedzUPU8pU7+7qC0ADSt6YbdhfQMWqvOt2PQHksGeDiG uPNWCsBTmRxoqqwwyUouaiyRTCmE4ySXf50SqRjrW13zWwIri4gM5a4Zh5CnPxPQgK+Cu4 c4ZQ9sukAnzs/GUe9zNcMo2YM2SqoRAnvZdcy4dGk9p1FV5w6ylpRVT5yTwjLe5lnG5E7Q uFN52nRSDmRo8TxnwTWm8tUaegnR3fNUTOIoHMD7GxLkLtkfG+otQricGac80w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pvlkx3LjLzPhF; Sun, 9 Apr 2023 21:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 339LZLcS081622; Sun, 9 Apr 2023 21:35:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 339LZLrV081621; Sun, 9 Apr 2023 21:35:21 GMT (envelope-from git) Date: Sun, 9 Apr 2023 21:35:21 GMT Message-Id: <202304092135.339LZLrV081621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: f1ad517df71c - stable/13 - Merge llvm-project release/15.x llvmorg-15.0.6-0-g088f33605d8a List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f1ad517df71ca639c58897254a216e36e999ac06 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=f1ad517df71ca639c58897254a216e36e999ac06 commit f1ad517df71ca639c58897254a216e36e999ac06 Author: Dimitry Andric AuthorDate: 2022-12-04 22:09:55 +0000 Commit: Dimitry Andric CommitDate: 2023-04-09 14:54:51 +0000 Merge llvm-project release/15.x llvmorg-15.0.6-0-g088f33605d8a This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-15.0.6-0-g088f33605d8a. PR: 265425 MFC after: 2 weeks (cherry picked from commit f3fd488f1e19a3d09c4bdcece893901de4f49cdd) --- ObsoleteFiles.inc | 4 +- .../llvm-project/clang/lib/CodeGen/TargetInfo.cpp | 8 +- .../clang/lib/Driver/ToolChains/Gnu.cpp | 40 +- contrib/llvm-project/clang/lib/Sema/SemaLookup.cpp | 8 +- contrib/llvm-project/clang/lib/Sema/SemaType.cpp | 3 + .../clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 6 + .../sanitizer_common_interceptors.inc | 2 +- contrib/llvm-project/libcxx/include/__config | 2 +- .../libcxx/include/__functional/function.h | 14 +- contrib/llvm-project/lld/ELF/Driver.cpp | 9 +- contrib/llvm-project/lld/ELF/InputFiles.cpp | 2 +- .../llvm-project/lld/MachO/UnwindInfoSection.cpp | 35 +- contrib/llvm-project/lld/MachO/UnwindInfoSection.h | 2 +- contrib/llvm-project/lld/MachO/Writer.cpp | 2 +- contrib/llvm-project/lldb/bindings/interfaces.swig | 3 - .../lldb/bindings/python/python-typemaps.swig | 2 +- .../llvm-project/lldb/include/lldb/API/SBType.h | 2 + .../lldb/include/lldb/Symbol/CompilerType.h | 24 +- .../lldb/include/lldb/Symbol/TypeSystem.h | 14 +- contrib/llvm-project/lldb/source/API/SBType.cpp | 12 +- .../Plugins/TypeSystem/Clang/TypeSystemClang.cpp | 81 ++- .../Plugins/TypeSystem/Clang/TypeSystemClang.h | 19 +- .../lldb/source/Symbol/CompilerType.cpp | 18 +- .../llvm-project/lldb/source/Symbol/TypeSystem.cpp | 12 +- .../llvm-project/llvm/lib/Analysis/VectorUtils.cpp | 7 +- .../CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 1 + .../llvm/lib/CodeGen/TypePromotion.cpp | 8 +- contrib/llvm-project/llvm/lib/IR/AutoUpgrade.cpp | 2 +- .../llvm-project/llvm/lib/Support/Unix/Signals.inc | 4 - .../lib/Target/AArch64/AArch64ISelLowering.cpp | 67 ++- .../llvm/lib/Target/AArch64/AArch64ISelLowering.h | 2 +- .../llvm/lib/Target/AMDGPU/SIISelLowering.cpp | 2 + .../llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp | 2 +- .../llvm/lib/Target/Sparc/SparcCallingConv.td | 10 +- .../llvm/lib/Target/Sparc/SparcISelLowering.cpp | 61 +- .../llvm/lib/Target/Sparc/SparcISelLowering.h | 5 + .../llvm/lib/Transforms/IPO/GlobalOpt.cpp | 2 +- .../Transforms/InstCombine/InstCombineCalls.cpp | 4 + .../llvm/lib/Transforms/Scalar/SROA.cpp | 19 +- .../llvm/lib/Transforms/Utils/VNCoercion.cpp | 4 +- etc/mtree/BSD.debug.dist | 2 +- etc/mtree/BSD.usr.dist | 2 +- lib/clang/headers/Makefile | 2 +- lib/clang/include/VCSVersion.inc | 6 +- lib/clang/include/clang/Basic/Version.inc | 6 +- lib/clang/include/clang/Config/config.h | 2 +- lib/clang/include/lld/Common/Version.inc | 2 +- lib/clang/include/lldb/Version/Version.inc | 6 +- lib/clang/include/llvm/Config/config.h | 4 +- lib/clang/include/llvm/Config/llvm-config.h | 4 +- lib/clang/include/llvm/Support/VCSRevision.h | 2 +- lib/libclang_rt/compiler-rt-vars.mk | 2 +- tools/build/mk/OptionalObsoleteFiles.inc | 644 ++++++++++----------- 53 files changed, 694 insertions(+), 514 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index ce5c9c15dae0..6f3d0f297515 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,7 +52,7 @@ # xargs -n1 | sort | uniq -d; # done -# 20230410: new clang import which bumps version from 14.0.5 to 15.0.3 +# 20230410: new clang import which bumps version from 14.0.5 to 15.0.6 OLD_FILES+=usr/lib/clang/14.0.5/include/cuda_wrappers/algorithm OLD_FILES+=usr/lib/clang/14.0.5/include/cuda_wrappers/complex OLD_FILES+=usr/lib/clang/14.0.5/include/cuda_wrappers/new @@ -363,7 +363,7 @@ OLD_FILES+=usr/lib/clang/14.0.5/share/msan_ignorelist.txt OLD_DIRS+=usr/lib/clang/14.0.5/share OLD_DIRS+=usr/lib/clang/14.0.5 -# 20230410: new libc++ import which bumps version from 14.0.5 to 15.0.3 +# 20230410: new libc++ import which bumps version from 14.0.5 to 15.0.6 OLD_FILES+=usr/include/c++/v1/__functional_base OLD_FILES+=usr/include/c++/v1/__libcpp_version OLD_FILES+=usr/include/c++/v1/__nullptr diff --git a/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp b/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp index 36e10e4df4c1..44743fa0206f 100644 --- a/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp @@ -7047,10 +7047,10 @@ Address ARMABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, // Empty records are ignored for parameter passing purposes. if (isEmptyRecord(getContext(), Ty, true)) { - Address Addr = Address(CGF.Builder.CreateLoad(VAListAddr), - getVAListElementType(CGF), SlotSize); - Addr = CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty)); - return Addr; + VAListAddr = CGF.Builder.CreateElementBitCast(VAListAddr, CGF.Int8PtrTy); + auto *Load = CGF.Builder.CreateLoad(VAListAddr); + Address Addr = Address(Load, CGF.Int8Ty, SlotSize); + return CGF.Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(Ty)); } CharUnits TySize = getContext().getTypeSizeInChars(Ty); diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp index f203cae1d329..665cdc3132fb 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp @@ -2139,31 +2139,21 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( // and gcc-toolsets. if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux && D.getVFS().exists("/opt/rh")) { - // Find the directory in /opt/rh/ starting with gcc-toolset-* or - // devtoolset-* with the highest version number and add that - // one to our prefixes. - std::string ChosenToolsetDir; - unsigned ChosenToolsetVersion = 0; - std::error_code EC; - for (llvm::vfs::directory_iterator LI = D.getVFS().dir_begin("/opt/rh", EC), - LE; - !EC && LI != LE; LI = LI.increment(EC)) { - StringRef ToolsetDir = llvm::sys::path::filename(LI->path()); - unsigned ToolsetVersion; - if ((!ToolsetDir.startswith("gcc-toolset-") && - !ToolsetDir.startswith("devtoolset-")) || - ToolsetDir.substr(ToolsetDir.rfind('-') + 1) - .getAsInteger(10, ToolsetVersion)) - continue; - - if (ToolsetVersion > ChosenToolsetVersion) { - ChosenToolsetVersion = ToolsetVersion; - ChosenToolsetDir = "/opt/rh/" + ToolsetDir.str(); - } - } - - if (ChosenToolsetVersion > 0) - Prefixes.push_back(ChosenToolsetDir + "/root/usr"); + // TODO: We may want to remove this, since the functionality + // can be achieved using config files. + Prefixes.push_back("/opt/rh/gcc-toolset-12/root/usr"); + Prefixes.push_back("/opt/rh/gcc-toolset-11/root/usr"); + Prefixes.push_back("/opt/rh/gcc-toolset-10/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-12/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-11/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-10/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-9/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-8/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-7/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-6/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-4/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-3/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-2/root/usr"); } // Fall back to /usr which is used by most non-Solaris systems. diff --git a/contrib/llvm-project/clang/lib/Sema/SemaLookup.cpp b/contrib/llvm-project/clang/lib/Sema/SemaLookup.cpp index 68158ec977cf..5d0d87fd2422 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaLookup.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaLookup.cpp @@ -939,11 +939,9 @@ bool Sema::LookupBuiltin(LookupResult &R) { // If this is a builtin on this (or all) targets, create the decl. if (unsigned BuiltinID = II->getBuiltinID()) { - // In C++, C2x, and OpenCL (spec v1.2 s6.9.f), we don't have any - // predefined library functions like 'malloc'. Instead, we'll just - // error. - if ((getLangOpts().CPlusPlus || getLangOpts().OpenCL || - getLangOpts().C2x) && + // In C++ and OpenCL (spec v1.2 s6.9.f), we don't have any predefined + // library functions like 'malloc'. Instead, we'll just error. + if ((getLangOpts().CPlusPlus || getLangOpts().OpenCL) && Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) return false; diff --git a/contrib/llvm-project/clang/lib/Sema/SemaType.cpp b/contrib/llvm-project/clang/lib/Sema/SemaType.cpp index 3ab5d26a9a75..edcac4d2ee9a 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaType.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaType.cpp @@ -6443,6 +6443,9 @@ GetTypeSourceInfoForDeclarator(TypeProcessingState &State, CurrTL = TL.getNextTypeLoc().getUnqualifiedLoc(); } + while (BTFTagAttributedTypeLoc TL = CurrTL.getAs()) + CurrTL = TL.getNextTypeLoc().getUnqualifiedLoc(); + while (DependentAddressSpaceTypeLoc TL = CurrTL.getAs()) { fillDependentAddressSpaceTypeLoc(TL, D.getTypeObject(i).getAttrs()); diff --git a/contrib/llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/contrib/llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 19149d079822..ab65612bce90 100644 --- a/contrib/llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/contrib/llvm-project/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -2839,6 +2839,12 @@ void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D, return; } + if (const auto *TPO = dyn_cast(D)) { + // FIXME: We should meaningfully implement this. + (void)TPO; + return; + } + llvm_unreachable("Support for this Decl not implemented."); } diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index 9af296b1853a..b29665a63390 100644 --- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -6703,7 +6703,7 @@ INTERCEPTOR(int, sem_init, __sanitizer_sem_t *s, int pshared, unsigned value) { COMMON_INTERCEPTOR_ENTER(ctx, sem_init, s, pshared, value); // Workaround a bug in glibc's "old" semaphore implementation by // zero-initializing the sem_t contents. This has to be done here because - // interceptors bind to the lowest symbols version by default, hitting the + // interceptors bind to the lowest version before glibc 2.36, hitting the // buggy code path while the non-sanitized build of the same code works fine. REAL(memset)(s, 0, sizeof(*s)); int res = REAL(sem_init)(s, pshared, value); diff --git a/contrib/llvm-project/libcxx/include/__config b/contrib/llvm-project/libcxx/include/__config index 589b5c3b2241..5f62b974170f 100644 --- a/contrib/llvm-project/libcxx/include/__config +++ b/contrib/llvm-project/libcxx/include/__config @@ -36,7 +36,7 @@ #ifdef __cplusplus -# define _LIBCPP_VERSION 15003 +# define _LIBCPP_VERSION 15006 # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) diff --git a/contrib/llvm-project/libcxx/include/__functional/function.h b/contrib/llvm-project/libcxx/include/__functional/function.h index db3af6e24101..55b607f3f804 100644 --- a/contrib/llvm-project/libcxx/include/__functional/function.h +++ b/contrib/llvm-project/libcxx/include/__functional/function.h @@ -883,7 +883,7 @@ template class __policy_func<_Rp(_ArgTypes...)> #endif // _LIBCPP_NO_RTTI }; -#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC) +#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) extern "C" void *_Block_copy(const void *); extern "C" void _Block_release(const void *); @@ -898,14 +898,22 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> public: _LIBCPP_INLINE_VISIBILITY explicit __func(__block_type const& __f) +#ifdef _LIBCPP_HAS_OBJC_ARC + : __f_(__f) +#else : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr)) +#endif { } // [TODO] add && to save on a retain _LIBCPP_INLINE_VISIBILITY explicit __func(__block_type __f, const _Alloc& /* unused */) +#ifdef _LIBCPP_HAS_OBJC_ARC + : __f_(__f) +#else : __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr)) +#endif { } virtual __base<_Rp(_ArgTypes...)>* __clone() const { @@ -921,8 +929,10 @@ public: } virtual void destroy() _NOEXCEPT { +#ifndef _LIBCPP_HAS_OBJC_ARC if (__f_) _Block_release(__f_); +#endif __f_ = 0; } @@ -950,7 +960,7 @@ public: #endif // _LIBCPP_NO_RTTI }; -#endif // _LIBCPP_HAS_EXTENSION_BLOCKS && !_LIBCPP_HAS_OBJC_ARC +#endif // _LIBCPP_HAS_EXTENSION_BLOCKS } // namespace __function diff --git a/contrib/llvm-project/lld/ELF/Driver.cpp b/contrib/llvm-project/lld/ELF/Driver.cpp index 296fb4220012..58d863776430 100644 --- a/contrib/llvm-project/lld/ELF/Driver.cpp +++ b/contrib/llvm-project/lld/ELF/Driver.cpp @@ -1330,12 +1330,15 @@ static void readConfigs(opt::InputArgList &args) { parseClangOption(std::string("-") + arg->getValue(), arg->getSpelling()); // GCC collect2 passes -plugin-opt=path/to/lto-wrapper with an absolute or - // relative path. Just ignore. If not ended with "lto-wrapper", consider it an + // relative path. Just ignore. If not ended with "lto-wrapper" (or + // "lto-wrapper.exe" for GCC cross-compiled for Windows), consider it an // unsupported LLVMgold.so option and error. - for (opt::Arg *arg : args.filtered(OPT_plugin_opt_eq)) - if (!StringRef(arg->getValue()).endswith("lto-wrapper")) + for (opt::Arg *arg : args.filtered(OPT_plugin_opt_eq)) { + StringRef v(arg->getValue()); + if (!v.endswith("lto-wrapper") && !v.endswith("lto-wrapper.exe")) error(arg->getSpelling() + ": unknown plugin option '" + arg->getValue() + "'"); + } config->passPlugins = args::getStrings(args, OPT_load_pass_plugins); diff --git a/contrib/llvm-project/lld/ELF/InputFiles.cpp b/contrib/llvm-project/lld/ELF/InputFiles.cpp index 927dc272b532..473809b05e9c 100644 --- a/contrib/llvm-project/lld/ELF/InputFiles.cpp +++ b/contrib/llvm-project/lld/ELF/InputFiles.cpp @@ -1157,7 +1157,7 @@ template void ObjFile::postParse() { continue; } - if (binding == STB_WEAK) + if (sym.binding == STB_WEAK || binding == STB_WEAK) continue; std::lock_guard lock(mu); ctx->duplicates.push_back({&sym, this, sec, eSym.st_value}); diff --git a/contrib/llvm-project/lld/MachO/UnwindInfoSection.cpp b/contrib/llvm-project/lld/MachO/UnwindInfoSection.cpp index ca6cbdfbb8bb..8f267251b7c0 100644 --- a/contrib/llvm-project/lld/MachO/UnwindInfoSection.cpp +++ b/contrib/llvm-project/lld/MachO/UnwindInfoSection.cpp @@ -158,7 +158,7 @@ class UnwindInfoSectionImpl final : public UnwindInfoSection { public: UnwindInfoSectionImpl() : cuOffsets(target->wordSize) {} uint64_t getSize() const override { return unwindInfoSize; } - void prepareRelocations() override; + void prepare() override; void finalize() override; void writeTo(uint8_t *buf) const override; @@ -166,6 +166,7 @@ private: void prepareRelocations(ConcatInputSection *); void relocateCompactUnwind(std::vector &); void encodePersonalities(); + Symbol *canonicalizePersonality(Symbol *); uint64_t unwindInfoSize = 0; std::vector symbolsVec; @@ -218,14 +219,24 @@ void UnwindInfoSection::addSymbol(const Defined *d) { } } -void UnwindInfoSectionImpl::prepareRelocations() { +void UnwindInfoSectionImpl::prepare() { // This iteration needs to be deterministic, since prepareRelocations may add // entries to the GOT. Hence the use of a MapVector for // UnwindInfoSection::symbols. for (const Defined *d : make_second_range(symbols)) - if (d->unwindEntry && - d->unwindEntry->getName() == section_names::compactUnwind) - prepareRelocations(d->unwindEntry); + if (d->unwindEntry) { + if (d->unwindEntry->getName() == section_names::compactUnwind) { + prepareRelocations(d->unwindEntry); + } else { + // We don't have to add entries to the GOT here because FDEs have + // explicit GOT relocations, so Writer::scanRelocations() will add those + // GOT entries. However, we still need to canonicalize the personality + // pointers (like prepareRelocations() does for CU entries) in order + // to avoid overflowing the 3-personality limit. + FDE &fde = cast(d->getFile())->fdes[d->unwindEntry]; + fde.personality = canonicalizePersonality(fde.personality); + } + } } // Compact unwind relocations have different semantics, so we handle them in a @@ -279,6 +290,7 @@ void UnwindInfoSectionImpl::prepareRelocations(ConcatInputSection *isec) { continue; } + // Similar to canonicalizePersonality(), but we also register a GOT entry. if (auto *defined = dyn_cast(s)) { // Check if we have created a synthetic symbol at the same address. Symbol *&personality = @@ -291,6 +303,7 @@ void UnwindInfoSectionImpl::prepareRelocations(ConcatInputSection *isec) { } continue; } + assert(isa(s)); in.got->addEntry(s); continue; @@ -320,6 +333,18 @@ void UnwindInfoSectionImpl::prepareRelocations(ConcatInputSection *isec) { } } +Symbol *UnwindInfoSectionImpl::canonicalizePersonality(Symbol *personality) { + if (auto *defined = dyn_cast_or_null(personality)) { + // Check if we have created a synthetic symbol at the same address. + Symbol *&synth = personalityTable[{defined->isec, defined->value}]; + if (synth == nullptr) + synth = defined; + else if (synth != defined) + return synth; + } + return personality; +} + // We need to apply the relocations to the pre-link compact unwind section // before converting it to post-link form. There should only be absolute // relocations here: since we are not emitting the pre-link CU section, there diff --git a/contrib/llvm-project/lld/MachO/UnwindInfoSection.h b/contrib/llvm-project/lld/MachO/UnwindInfoSection.h index c6b334731c75..f2bc3213a127 100644 --- a/contrib/llvm-project/lld/MachO/UnwindInfoSection.h +++ b/contrib/llvm-project/lld/MachO/UnwindInfoSection.h @@ -24,7 +24,7 @@ public: // section entirely. bool isNeeded() const override { return !allEntriesAreOmitted; } void addSymbol(const Defined *); - virtual void prepareRelocations() = 0; + virtual void prepare() = 0; protected: UnwindInfoSection(); diff --git a/contrib/llvm-project/lld/MachO/Writer.cpp b/contrib/llvm-project/lld/MachO/Writer.cpp index 3c44a60f4be2..ce9672dd0b4f 100644 --- a/contrib/llvm-project/lld/MachO/Writer.cpp +++ b/contrib/llvm-project/lld/MachO/Writer.cpp @@ -675,7 +675,7 @@ void Writer::scanRelocations() { } } - in.unwindInfo->prepareRelocations(); + in.unwindInfo->prepare(); } void Writer::scanSymbols() { diff --git a/contrib/llvm-project/lldb/bindings/interfaces.swig b/contrib/llvm-project/lldb/bindings/interfaces.swig index c9a6d0f06056..021c7683d170 100644 --- a/contrib/llvm-project/lldb/bindings/interfaces.swig +++ b/contrib/llvm-project/lldb/bindings/interfaces.swig @@ -1,8 +1,5 @@ /* Various liblldb typedefs that SWIG needs to know about. */ #define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */ -/* The ISO C99 standard specifies that in C++ implementations limit macros such - as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */ -#define __STDC_LIMIT_MACROS %include "stdint.i" %include "lldb/lldb-defines.h" diff --git a/contrib/llvm-project/lldb/bindings/python/python-typemaps.swig b/contrib/llvm-project/lldb/bindings/python/python-typemaps.swig index bf3de66b91bf..d45431c771ca 100644 --- a/contrib/llvm-project/lldb/bindings/python/python-typemaps.swig +++ b/contrib/llvm-project/lldb/bindings/python/python-typemaps.swig @@ -435,7 +435,7 @@ template <> bool SetNumberFromPyObject(double &number, PyObject *obj) { %typemap(out) lldb::FileSP { $result = nullptr; - lldb::FileSP &sp = $1; + const lldb::FileSP &sp = $1; if (sp) { PythonFile pyfile = unwrapOrSetPythonException(PythonFile::FromFile(*sp)); if (!pyfile.IsValid()) diff --git a/contrib/llvm-project/lldb/include/lldb/API/SBType.h b/contrib/llvm-project/lldb/include/lldb/API/SBType.h index 244d328b51f4..aa45aeeec476 100644 --- a/contrib/llvm-project/lldb/include/lldb/API/SBType.h +++ b/contrib/llvm-project/lldb/include/lldb/API/SBType.h @@ -182,6 +182,8 @@ public: lldb::SBType GetTemplateArgumentType(uint32_t idx); + /// Return the TemplateArgumentKind of the template argument at index idx. + /// Variadic argument packs are automatically expanded. lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx); lldb::SBType GetFunctionReturnType(); diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerType.h b/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerType.h index 0ad05a27570e..aefd19d0a859 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerType.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerType.h @@ -338,14 +338,28 @@ public: GetIndexOfChildMemberWithName(const char *name, bool omit_empty_base_classes, std::vector &child_indexes) const; - size_t GetNumTemplateArguments() const; - - lldb::TemplateArgumentKind GetTemplateArgumentKind(size_t idx) const; - CompilerType GetTypeTemplateArgument(size_t idx) const; + /// Return the number of template arguments the type has. + /// If expand_pack is true, then variadic argument packs are automatically + /// expanded to their supplied arguments. If it is false an argument pack + /// will only count as 1 argument. + size_t GetNumTemplateArguments(bool expand_pack = false) const; + + // Return the TemplateArgumentKind of the template argument at index idx. + // If expand_pack is true, then variadic argument packs are automatically + // expanded to their supplied arguments. With expand_pack set to false, an + // arguement pack will count as 1 argument and return a type of Pack. + lldb::TemplateArgumentKind + GetTemplateArgumentKind(size_t idx, bool expand_pack = false) const; + CompilerType GetTypeTemplateArgument(size_t idx, + bool expand_pack = false) const; /// Returns the value of the template argument and its type. + /// If expand_pack is true, then variadic argument packs are automatically + /// expanded to their supplied arguments. With expand_pack set to false, an + /// arguement pack will count as 1 argument and it is invalid to call this + /// method on the pack argument. llvm::Optional - GetIntegralTemplateArgument(size_t idx) const; + GetIntegralTemplateArgument(size_t idx, bool expand_pack = false) const; CompilerType GetTypeForFormatters() const; diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/TypeSystem.h b/contrib/llvm-project/lldb/include/lldb/Symbol/TypeSystem.h index be5783596897..769449a4933b 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/TypeSystem.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/TypeSystem.h @@ -346,14 +346,18 @@ public: const char *name, bool omit_empty_base_classes, std::vector &child_indexes) = 0; - virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type); + virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type, + bool expand_pack); virtual lldb::TemplateArgumentKind - GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx); - virtual CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx); + GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx, + bool expand_pack); + virtual CompilerType + GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, + bool expand_pack); virtual llvm::Optional - GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx); + GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, + bool expand_pack); // Dumping types diff --git a/contrib/llvm-project/lldb/source/API/SBType.cpp b/contrib/llvm-project/lldb/source/API/SBType.cpp index 533930c0544b..adc60a084367 100644 --- a/contrib/llvm-project/lldb/source/API/SBType.cpp +++ b/contrib/llvm-project/lldb/source/API/SBType.cpp @@ -542,7 +542,8 @@ uint32_t SBType::GetNumberOfTemplateArguments() { LLDB_INSTRUMENT_VA(this); if (IsValid()) - return m_opaque_sp->GetCompilerType(false).GetNumTemplateArguments(); + return m_opaque_sp->GetCompilerType(false).GetNumTemplateArguments( + /*expand_pack=*/true); return 0; } @@ -553,13 +554,15 @@ lldb::SBType SBType::GetTemplateArgumentType(uint32_t idx) { return SBType(); CompilerType type; + const bool expand_pack = true; switch(GetTemplateArgumentKind(idx)) { case eTemplateArgumentKindType: - type = m_opaque_sp->GetCompilerType(false).GetTypeTemplateArgument(idx); + type = m_opaque_sp->GetCompilerType(false).GetTypeTemplateArgument( + idx, expand_pack); break; case eTemplateArgumentKindIntegral: type = m_opaque_sp->GetCompilerType(false) - .GetIntegralTemplateArgument(idx) + .GetIntegralTemplateArgument(idx, expand_pack) ->type; break; default: @@ -574,7 +577,8 @@ lldb::TemplateArgumentKind SBType::GetTemplateArgumentKind(uint32_t idx) { LLDB_INSTRUMENT_VA(this, idx); if (IsValid()) - return m_opaque_sp->GetCompilerType(false).GetTemplateArgumentKind(idx); + return m_opaque_sp->GetCompilerType(false).GetTemplateArgumentKind( + idx, /*expand_pack=*/true); return eTemplateArgumentKindNull; } diff --git a/contrib/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/contrib/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 5f5649a32e19..b47d86d76337 100644 --- a/contrib/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/contrib/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -7096,7 +7096,8 @@ TypeSystemClang::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, } size_t -TypeSystemClang::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) { +TypeSystemClang::GetNumTemplateArguments(lldb::opaque_compiler_type_t type, + bool expand_pack) { if (!type) return 0; @@ -7111,8 +7112,17 @@ TypeSystemClang::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) { const clang::ClassTemplateSpecializationDecl *template_decl = llvm::dyn_cast( cxx_record_decl); - if (template_decl) - return template_decl->getTemplateArgs().size(); + if (template_decl) { + const auto &template_arg_list = template_decl->getTemplateArgs(); + size_t num_args = template_arg_list.size(); + assert(num_args && "template specialization without any args"); + if (expand_pack && num_args) { + const auto &pack = template_arg_list[num_args - 1]; + if (pack.getKind() == clang::TemplateArgument::Pack) + num_args += pack.pack_size() - 1; + } + return num_args; + } } } break; @@ -7149,15 +7159,51 @@ TypeSystemClang::GetAsTemplateSpecialization( } } +const TemplateArgument * +GetNthTemplateArgument(const clang::ClassTemplateSpecializationDecl *decl, + size_t idx, bool expand_pack) { + const auto &args = decl->getTemplateArgs(); + const size_t args_size = args.size(); + + assert(args_size && "template specialization without any args"); + if (!args_size) + return nullptr; + + const size_t last_idx = args_size - 1; + + // We're asked for a template argument that can't be a parameter pack, so + // return it without worrying about 'expand_pack'. + if (idx < last_idx) + return &args[idx]; + + // We're asked for the last template argument but we don't want/need to + // expand it. + if (!expand_pack || args[last_idx].getKind() != clang::TemplateArgument::Pack) + return idx >= args.size() ? nullptr : &args[idx]; + + // Index into the expanded pack. + // Note that 'idx' counts from the beginning of all template arguments + // (including the ones preceding the parameter pack). + const auto &pack = args[last_idx]; + const size_t pack_idx = idx - last_idx; + const size_t pack_size = pack.pack_size(); + assert(pack_idx < pack_size && "parameter pack index out-of-bounds"); + return &pack.pack_elements()[pack_idx]; +} + lldb::TemplateArgumentKind TypeSystemClang::GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, - size_t arg_idx) { + size_t arg_idx, bool expand_pack) { const clang::ClassTemplateSpecializationDecl *template_decl = GetAsTemplateSpecialization(type); - if (! template_decl || arg_idx >= template_decl->getTemplateArgs().size()) + if (!template_decl) + return eTemplateArgumentKindNull; + + const auto *arg = GetNthTemplateArgument(template_decl, arg_idx, expand_pack); + if (!arg) return eTemplateArgumentKindNull; - switch (template_decl->getTemplateArgs()[arg_idx].getKind()) { + switch (arg->getKind()) { case clang::TemplateArgument::Null: return eTemplateArgumentKindNull; @@ -7190,35 +7236,32 @@ TypeSystemClang::GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, CompilerType TypeSystemClang::GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx) { + size_t idx, bool expand_pack) { const clang::ClassTemplateSpecializationDecl *template_decl = GetAsTemplateSpecialization(type); - if (!template_decl || idx >= template_decl->getTemplateArgs().size()) + if (!template_decl) return CompilerType(); - const clang::TemplateArgument &template_arg = - template_decl->getTemplateArgs()[idx]; - if (template_arg.getKind() != clang::TemplateArgument::Type) + const auto *arg = GetNthTemplateArgument(template_decl, idx, expand_pack); + if (!arg || arg->getKind() != clang::TemplateArgument::Type) return CompilerType(); - return GetType(template_arg.getAsType()); + return GetType(arg->getAsType()); } Optional TypeSystemClang::GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx) { + size_t idx, bool expand_pack) { const clang::ClassTemplateSpecializationDecl *template_decl = GetAsTemplateSpecialization(type); - if (! template_decl || idx >= template_decl->getTemplateArgs().size()) + if (!template_decl) return llvm::None; - const clang::TemplateArgument &template_arg = - template_decl->getTemplateArgs()[idx]; - if (template_arg.getKind() != clang::TemplateArgument::Integral) + const auto *arg = GetNthTemplateArgument(template_decl, idx, expand_pack); + if (!arg || arg->getKind() != clang::TemplateArgument::Integral) return llvm::None; - return { - {template_arg.getAsIntegral(), GetType(template_arg.getIntegralType())}}; + return {{arg->getAsIntegral(), GetType(arg->getIntegralType())}}; } CompilerType TypeSystemClang::GetTypeForFormatters(void *type) { diff --git a/contrib/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/contrib/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 4883f510eb31..6ecbfdd4d1a5 100644 --- a/contrib/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/contrib/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -91,7 +91,7 @@ public: void SetOwningModule(OptionalClangModuleID id); /// \} }; - + /// A TypeSystem implementation based on Clang. /// /// This class uses a single clang::ASTContext as the backend for storing @@ -334,7 +334,7 @@ public: llvm::SmallVector names; llvm::SmallVector args; - + const char * pack_name = nullptr; std::unique_ptr packed_args; }; @@ -539,7 +539,7 @@ public: #ifndef NDEBUG bool Verify(lldb::opaque_compiler_type_t type) override; #endif - + bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override; @@ -812,16 +812,17 @@ public: const char *name, bool omit_empty_base_classes, std::vector &child_indexes) override; - size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override; + size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type, + bool expand_pack) override; lldb::TemplateArgumentKind - GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, - size_t idx) override; + GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx, + bool expand_pack) override; CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx) override; + size_t idx, bool expand_pack) override; llvm::Optional - GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx) override; + GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, + bool expand_pack) override; CompilerType GetTypeForFormatters(void *type) override; diff --git a/contrib/llvm-project/lldb/source/Symbol/CompilerType.cpp b/contrib/llvm-project/lldb/source/Symbol/CompilerType.cpp index ac98352c235e..bef456583687 100644 --- a/contrib/llvm-project/lldb/source/Symbol/CompilerType.cpp +++ b/contrib/llvm-project/lldb/source/Symbol/CompilerType.cpp @@ -659,30 +659,32 @@ size_t CompilerType::GetIndexOfChildMemberWithName( return 0; } -size_t CompilerType::GetNumTemplateArguments() const { +size_t CompilerType::GetNumTemplateArguments(bool expand_pack) const { if (IsValid()) { - return m_type_system->GetNumTemplateArguments(m_type); + return m_type_system->GetNumTemplateArguments(m_type, expand_pack); } return 0; } -TemplateArgumentKind CompilerType::GetTemplateArgumentKind(size_t idx) const { +TemplateArgumentKind +CompilerType::GetTemplateArgumentKind(size_t idx, bool expand_pack) const { if (IsValid()) - return m_type_system->GetTemplateArgumentKind(m_type, idx); + return m_type_system->GetTemplateArgumentKind(m_type, idx, expand_pack); return eTemplateArgumentKindNull; } -CompilerType CompilerType::GetTypeTemplateArgument(size_t idx) const { +CompilerType CompilerType::GetTypeTemplateArgument(size_t idx, + bool expand_pack) const { if (IsValid()) { - return m_type_system->GetTypeTemplateArgument(m_type, idx); + return m_type_system->GetTypeTemplateArgument(m_type, idx, expand_pack); } return CompilerType(); } llvm::Optional -CompilerType::GetIntegralTemplateArgument(size_t idx) const { +CompilerType::GetIntegralTemplateArgument(size_t idx, bool expand_pack) const { if (IsValid()) - return m_type_system->GetIntegralTemplateArgument(m_type, idx); + return m_type_system->GetIntegralTemplateArgument(m_type, idx, expand_pack); return llvm::None; } diff --git a/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp b/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp index 3092dc0bf0a4..412373533aab 100644 --- a/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp +++ b/contrib/llvm-project/lldb/source/Symbol/TypeSystem.cpp @@ -118,23 +118,25 @@ CompilerType TypeSystem::GetTypeForFormatters(void *type) { return CompilerType(this, type); } -size_t TypeSystem::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) { +size_t TypeSystem::GetNumTemplateArguments(lldb::opaque_compiler_type_t type, + bool expand_pack) { return 0; } TemplateArgumentKind -TypeSystem::GetTemplateArgumentKind(opaque_compiler_type_t type, size_t idx) { +TypeSystem::GetTemplateArgumentKind(opaque_compiler_type_t type, size_t idx, + bool expand_pack) { return eTemplateArgumentKindNull; } CompilerType TypeSystem::GetTypeTemplateArgument(opaque_compiler_type_t type, - size_t idx) { + size_t idx, bool expand_pack) { return CompilerType(); } llvm::Optional -TypeSystem::GetIntegralTemplateArgument(opaque_compiler_type_t type, - size_t idx) { +TypeSystem::GetIntegralTemplateArgument(opaque_compiler_type_t type, size_t idx, + bool expand_pack) { return llvm::None; } diff --git a/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp b/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp index c4795a80ead2..bc20f33f174c 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/VectorUtils.cpp @@ -1110,6 +1110,12 @@ void InterleavedAccessInfo::collectConstStrideAccesses( continue; Type *ElementTy = getLoadStoreType(&I); + // Currently, codegen doesn't support cases where the type size doesn't + // match the alloc size. Skip them for now. + uint64_t Size = DL.getTypeAllocSize(ElementTy); + if (Size * 8 != DL.getTypeSizeInBits(ElementTy)) + continue; + // We don't check wrapping here because we don't know yet if Ptr will be // part of a full group or a group with gaps. Checking wrapping for all // pointers (even those that end up in groups with no gaps) will be overly @@ -1121,7 +1127,6 @@ void InterleavedAccessInfo::collectConstStrideAccesses( /*Assume=*/true, /*ShouldCheckWrap=*/false); const SCEV *Scev = replaceSymbolicStrideSCEV(PSE, Strides, Ptr); - uint64_t Size = DL.getTypeAllocSize(ElementTy); AccessStrideInfo[&I] = StrideDescriptor(Stride, Scev, Size, getLoadStoreAlignment(&I)); } diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 35650b9bd00e..ecdaef0442da 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -9693,6 +9693,7 @@ TargetLowering::LowerCallTo(TargetLowering::CallLoweringInfo &CLI) const { Entry.Alignment = Alignment; CLI.getArgs().insert(CLI.getArgs().begin(), Entry); CLI.NumFixedArgs += 1; + CLI.getArgs()[0].IndirectType = CLI.RetTy; CLI.RetTy = Type::getVoidTy(CLI.RetTy->getContext()); // sret demotion isn't compatible with tail-calls, since the sret argument diff --git a/contrib/llvm-project/llvm/lib/CodeGen/TypePromotion.cpp b/contrib/llvm-project/llvm/lib/CodeGen/TypePromotion.cpp index 8dc8d381ad16..a63118067139 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/TypePromotion.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/TypePromotion.cpp @@ -569,7 +569,8 @@ void IRPromoter::TruncateSinks() { void IRPromoter::Cleanup() { LLVM_DEBUG(dbgs() << "IR Promotion: Cleanup..\n"); // Some zexts will now have become redundant, along with their trunc - // operands, so remove them + // operands, so remove them. + // Some zexts need to be replaced with truncate if src bitwidth is larger. for (auto *V : Visited) { if (!isa(V)) continue; @@ -584,6 +585,11 @@ void IRPromoter::Cleanup() { << "\n"); ReplaceAllUsersOfWith(ZExt, Src); continue; + } else if (ZExt->getSrcTy()->getScalarSizeInBits() > PromotedWidth) { + IRBuilder<> Builder{ZExt}; + Value *Trunc = Builder.CreateTrunc(Src, ZExt->getDestTy()); + ReplaceAllUsersOfWith(ZExt, Trunc); + continue; } // We've inserted a trunc for a zext sink, but we already know that the diff --git a/contrib/llvm-project/llvm/lib/IR/AutoUpgrade.cpp b/contrib/llvm-project/llvm/lib/IR/AutoUpgrade.cpp index 75594f90c926..b9962da1d302 100644 --- a/contrib/llvm-project/llvm/lib/IR/AutoUpgrade.cpp +++ b/contrib/llvm-project/llvm/lib/IR/AutoUpgrade.cpp @@ -1040,7 +1040,7 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { Name, F->getParent()); // The new function may also need remangling. - if (auto Result = llvm::Intrinsic::remangleIntrinsicFunction(F)) + if (auto Result = llvm::Intrinsic::remangleIntrinsicFunction(NewFn)) NewFn = *Result; return true; } diff --git a/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc b/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc index bf145bffe8bf..23ac012b9e00 100644 --- a/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc +++ b/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc @@ -432,10 +432,6 @@ void llvm::sys::SetOneShotPipeSignalFunction(void (*Handler)()) { } void llvm::sys::DefaultOneShotPipeSignalHandler() { - // UNIX03 conformance requires a non-zero exit code and an error message - // to stderr when writing to a closed stdout fails. - errs() << "error: write on a pipe with no reader\n"; - // Send a special return code that drivers can check for, from sysexits.h. exit(EX_IOERR); } diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index c28216048d7c..06e21f90ebf1 100644 --- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -5805,7 +5805,7 @@ SDValue AArch64TargetLowering::LowerFormalArguments( assert(!Res && "Call operand has unhandled type"); (void)Res; } - SmallVector ArgValues; + unsigned ExtraArgLocs = 0; for (unsigned i = 0, e = Ins.size(); i != e; ++i) { CCValAssign &VA = ArgLocs[i - ExtraArgLocs]; @@ -6157,17 +6157,10 @@ void AArch64TargetLowering::saveVarArgRegisters(CCState &CCInfo, /// appropriate copies out of appropriate physical registers. SDValue AArch64TargetLowering::LowerCallResult( SDValue Chain, SDValue InFlag, CallingConv::ID CallConv, bool isVarArg, - const SmallVectorImpl &Ins, const SDLoc &DL, + const SmallVectorImpl &RVLocs, const SDLoc &DL, SelectionDAG &DAG, SmallVectorImpl &InVals, bool isThisReturn, SDValue ThisVal) const { - CCAssignFn *RetCC = CCAssignFnForReturn(CallConv); - // Assign locations to each value returned by this call. - SmallVector RVLocs; DenseMap CopiedRegs; - CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(), RVLocs, - *DAG.getContext()); - CCInfo.AnalyzeCallResult(Ins, RetCC); - // Copy all of the result registers out of their specified physreg. for (unsigned i = 0; i != RVLocs.size(); ++i) { CCValAssign VA = RVLocs[i]; @@ -6508,17 +6501,39 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI, *** 1199 LINES SKIPPED ***