Date: Thu, 5 Mar 2020 18:05:38 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r358679 - in vendor/llvm-project/release-10.x: clang/include/clang/AST clang/include/clang/Sema clang/lib/AST clang/lib/Format clang/lib/Parse clang/lib/Sema lld/docs lldb/source/Plugin... Message-ID: <202003051805.025I5cRl078190@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Thu Mar 5 18:05:37 2020 New Revision: 358679 URL: https://svnweb.freebsd.org/changeset/base/358679 Log: Vendor import of llvm-project branch release/10.x llvmorg-10.0.0-rc3-1-gc290cb61fdc. Added: vendor/llvm-project/release-10.x/llvm/include/llvm/Support/Windows/ vendor/llvm-project/release-10.x/llvm/include/llvm/Support/Windows/WindowsSupport.h (contents, props changed) Deleted: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/WindowsSupport.h Modified: vendor/llvm-project/release-10.x/clang/include/clang/AST/Expr.h vendor/llvm-project/release-10.x/clang/include/clang/Sema/Sema.h vendor/llvm-project/release-10.x/clang/lib/AST/ASTImporter.cpp vendor/llvm-project/release-10.x/clang/lib/Format/TokenAnnotator.cpp vendor/llvm-project/release-10.x/clang/lib/Parse/ParseExpr.cpp vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExpr.cpp vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExprCXX.cpp vendor/llvm-project/release-10.x/clang/lib/Sema/TreeTransform.h vendor/llvm-project/release-10.x/lld/docs/ReleaseNotes.rst vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp vendor/llvm-project/release-10.x/llvm/include/llvm/module.modulemap vendor/llvm-project/release-10.x/llvm/lib/Analysis/TargetLibraryInfo.cpp vendor/llvm-project/release-10.x/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/CRC.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/Compression.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/CrashRecoveryContext.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/InitLLVM.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/RandomNumberGenerator.cpp vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/DynamicLibrary.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Host.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Memory.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Path.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Process.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Program.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Signals.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/ThreadLocal.inc vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Threading.inc vendor/llvm-project/release-10.x/llvm/lib/Support/raw_ostream.cpp vendor/llvm-project/release-10.x/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp vendor/llvm-project/release-10.x/llvm/lib/Transforms/Scalar/SROA.cpp vendor/llvm-project/release-10.x/llvm/tools/llvm-ar/llvm-ar.cpp Modified: vendor/llvm-project/release-10.x/clang/include/clang/AST/Expr.h ============================================================================== --- vendor/llvm-project/release-10.x/clang/include/clang/AST/Expr.h Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/clang/include/clang/AST/Expr.h Thu Mar 5 18:05:37 2020 (r358679) @@ -3955,14 +3955,14 @@ class StmtExpr : public Expr { Stmt *SubStmt; SourceLocation LParenLoc, RParenLoc; public: - // FIXME: Does type-dependence need to be computed differently? - // FIXME: Do we need to compute instantiation instantiation-dependence for - // statements? (ugh!) StmtExpr(CompoundStmt *substmt, QualType T, - SourceLocation lp, SourceLocation rp) : + SourceLocation lp, SourceLocation rp, bool InDependentContext) : + // Note: we treat a statement-expression in a dependent context as always + // being value- and instantiation-dependent. This matches the behavior of + // lambda-expressions and GCC. Expr(StmtExprClass, T, VK_RValue, OK_Ordinary, - T->isDependentType(), false, false, false), - SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) { } + T->isDependentType(), InDependentContext, InDependentContext, false), + SubStmt(substmt), LParenLoc(lp), RParenLoc(rp) {} /// Build an empty statement expression. explicit StmtExpr(EmptyShell Empty) : Expr(StmtExprClass, Empty) { } Modified: vendor/llvm-project/release-10.x/clang/include/clang/Sema/Sema.h ============================================================================== --- vendor/llvm-project/release-10.x/clang/include/clang/Sema/Sema.h Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/clang/include/clang/Sema/Sema.h Thu Mar 5 18:05:37 2020 (r358679) @@ -4923,7 +4923,7 @@ class Sema final { (public) LabelDecl *TheDecl); void ActOnStartStmtExpr(); - ExprResult ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, + ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc); // "({..})" // Handle the final expression in a statement expression. ExprResult ActOnStmtExprResult(ExprResult E); Modified: vendor/llvm-project/release-10.x/clang/lib/AST/ASTImporter.cpp ============================================================================== --- vendor/llvm-project/release-10.x/clang/lib/AST/ASTImporter.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/clang/lib/AST/ASTImporter.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -6724,8 +6724,9 @@ ExpectedStmt ASTNodeImporter::VisitStmtExpr(StmtExpr * SourceLocation ToLParenLoc, ToRParenLoc; std::tie(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc) = *Imp; - return new (Importer.getToContext()) StmtExpr( - ToSubStmt, ToType, ToLParenLoc, ToRParenLoc); + return new (Importer.getToContext()) + StmtExpr(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc, + E->isInstantiationDependent()); } ExpectedStmt ASTNodeImporter::VisitUnaryOperator(UnaryOperator *E) { Modified: vendor/llvm-project/release-10.x/clang/lib/Format/TokenAnnotator.cpp ============================================================================== --- vendor/llvm-project/release-10.x/clang/lib/Format/TokenAnnotator.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/clang/lib/Format/TokenAnnotator.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -2707,10 +2707,17 @@ bool TokenAnnotator::spaceRequiredBetween(const Annota return false; if (Right.isOneOf(tok::star, tok::amp, tok::ampamp) && (Left.is(tok::identifier) || Left.isSimpleTypeSpecifier()) && - Left.Previous && Left.Previous->is(tok::kw_operator)) - // Space between the type and the * - // operator void*(), operator char*(), operator Foo*() dependant - // on PointerAlignment style. + // Space between the type and the * in: + // operator void*() + // operator char*() + // operator /*comment*/ const char*() + // operator volatile /*comment*/ char*() + // operator Foo*() + // dependent on PointerAlignment style. + Left.Previous && + (Left.Previous->endsSequence(tok::kw_operator) || + Left.Previous->endsSequence(tok::kw_const, tok::kw_operator) || + Left.Previous->endsSequence(tok::kw_volatile, tok::kw_operator))) return (Style.PointerAlignment != FormatStyle::PAS_Left); const auto SpaceRequiredForArrayInitializerLSquare = [](const FormatToken &LSquareTok, const FormatStyle &Style) { Modified: vendor/llvm-project/release-10.x/clang/lib/Parse/ParseExpr.cpp ============================================================================== --- vendor/llvm-project/release-10.x/clang/lib/Parse/ParseExpr.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/clang/lib/Parse/ParseExpr.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -2655,7 +2655,8 @@ Parser::ParseParenExpression(ParenParseOption &ExprTyp // If the substmt parsed correctly, build the AST node. if (!Stmt.isInvalid()) { - Result = Actions.ActOnStmtExpr(OpenLoc, Stmt.get(), Tok.getLocation()); + Result = Actions.ActOnStmtExpr(getCurScope(), OpenLoc, Stmt.get(), + Tok.getLocation()); } else { Actions.ActOnStmtExprError(); } Modified: vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExpr.cpp ============================================================================== --- vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExpr.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExpr.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -13908,9 +13908,8 @@ void Sema::ActOnStmtExprError() { PopExpressionEvaluationContext(); } -ExprResult -Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, - SourceLocation RPLoc) { // "({..})" +ExprResult Sema::ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, + SourceLocation RPLoc) { // "({..})" assert(SubStmt && isa<CompoundStmt>(SubStmt) && "Invalid action invocation!"); CompoundStmt *Compound = cast<CompoundStmt>(SubStmt); @@ -13939,9 +13938,18 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStm } } + bool IsDependentContext = false; + if (S) + IsDependentContext = S->getTemplateParamParent() != nullptr; + else + // FIXME: This is not correct when substituting inside a templated + // context that isn't a DeclContext (such as a variable template). + IsDependentContext = CurContext->isDependentContext(); + // FIXME: Check that expression type is complete/non-abstract; statement // expressions are not lvalues. - Expr *ResStmtExpr = new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc); + Expr *ResStmtExpr = + new (Context) StmtExpr(Compound, Ty, LPLoc, RPLoc, IsDependentContext); if (StmtExprMayBindToTemp) return MaybeBindToTemporary(ResStmtExpr); return ResStmtExpr; Modified: vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExprCXX.cpp ============================================================================== --- vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExprCXX.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/clang/lib/Sema/SemaExprCXX.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -6800,8 +6800,9 @@ Stmt *Sema::MaybeCreateStmtWithCleanups(Stmt *SubStmt) // a new AsmStmtWithTemporaries. CompoundStmt *CompStmt = CompoundStmt::Create( Context, SubStmt, SourceLocation(), SourceLocation()); - Expr *E = new (Context) StmtExpr(CompStmt, Context.VoidTy, SourceLocation(), - SourceLocation()); + Expr *E = new (Context) + StmtExpr(CompStmt, Context.VoidTy, SourceLocation(), SourceLocation(), + CurContext->isDependentContext()); return MaybeCreateExprWithCleanups(E); } Modified: vendor/llvm-project/release-10.x/clang/lib/Sema/TreeTransform.h ============================================================================== --- vendor/llvm-project/release-10.x/clang/lib/Sema/TreeTransform.h Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/clang/lib/Sema/TreeTransform.h Thu Mar 5 18:05:37 2020 (r358679) @@ -2526,10 +2526,9 @@ class TreeTransform { (public) /// /// By default, performs semantic analysis to build the new expression. /// Subclasses may override this routine to provide different behavior. - ExprResult RebuildStmtExpr(SourceLocation LParenLoc, - Stmt *SubStmt, - SourceLocation RParenLoc) { - return getSema().ActOnStmtExpr(LParenLoc, SubStmt, RParenLoc); + ExprResult RebuildStmtExpr(SourceLocation LParenLoc, Stmt *SubStmt, + SourceLocation RParenLoc) { + return getSema().ActOnStmtExpr(nullptr, LParenLoc, SubStmt, RParenLoc); } /// Build a new __builtin_choose_expr expression. @@ -11801,6 +11800,8 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr NewTrailingRequiresClause = getDerived().TransformExpr(TRC); // Create the local class that will describe the lambda. + // FIXME: KnownDependent below is wrong when substituting inside a templated + // context that isn't a DeclContext (such as a variable template). CXXRecordDecl *OldClass = E->getLambdaClass(); CXXRecordDecl *Class = getSema().createLambdaClosureType(E->getIntroducerRange(), Modified: vendor/llvm-project/release-10.x/lld/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm-project/release-10.x/lld/docs/ReleaseNotes.rst Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/lld/docs/ReleaseNotes.rst Thu Mar 5 18:05:37 2020 (r358679) @@ -5,10 +5,6 @@ lld 10.0.0 Release Notes .. contents:: :local: -.. warning:: - These are in-progress notes for the upcoming LLVM 10.0.0 release. - Release notes for previous releases can be found on - `the Download Page <https://releases.llvm.org/download.html>`_. Introduction ============ @@ -33,51 +29,95 @@ ELF Improvements * New ``elf32btsmipn32_fbsd`` and ``elf32ltsmipn32_fbsd`` emulations are supported. -* Relax MIPS ``jalr``and ``jr`` instructions marked by the ``R_MIPS_JALR`` +* Relax MIPS ``jalr`` and ``jr`` instructions marked by the ``R_MIPS_JALR`` relocation. +* For certain "undefined symbol" errors, a definition with a close spelling will be suggested. + (`D67039 <https://reviews.llvm.org/D67039>`_) +* ``extern "C"`` is suggested if an undefined reference is mangled(unmangled) while there + is a likely unmangled(mangled) definition. + (`D69592 <https://reviews.llvm.org/D69592>`_ `D69650 <https://reviews.llvm.org/D69650>`_) +* New ``-z noseparate-code``, ``-z separate-code`` and ``-z separate-loadable-segments``. + ``-z noseparate-code`` is the default, which can reduce sizes of linked binaries by up to + 3 times maxpagesize. + (`D64903 <https://reviews.llvm.org/D64903>`_ `D67481 <https://reviews.llvm.org/D67481>`_) +* ``-z force-bti`` and ``-z pac-plt`` are added for AArch64 Branch Target Identification and Pointer Authentication. + (`D62609 <https://reviews.llvm.org/D62609>`_) +* ``--fix-cortex-a8`` is added to fix erratum 657417. + (`D67284 <https://reviews.llvm.org/D67284>`_) +* ``-z force-ibt`` and ``-z shstk`` are added for Intel Control-flow Enforcement Technology. + (`D59780 <https://reviews.llvm.org/D59780>`_) +* ``PT_GNU_PROPERTY`` is added to help loaders locate the ``.note.gnu.property`` section. + It may be used by a future Linux kernel. + (`D70961 <https://reviews.llvm.org/D70961>`_) +* For ``--compress-debug-sections=zlib``, ``-O0`` and ``-O1`` enable compression level 1 + while ``-O2`` enables compression level 6. ``-O1`` (default) is faster than before. + (`D70658 <https://reviews.llvm.org/D70658>`_) +* Range extension thunks with addends are implemented for AArch64, PowerPC32 and PowerPC64. + (`D70637 <https://reviews.llvm.org/D70637>`_ `D70937 <https://reviews.llvm.org/D70937>`_ + `D73424 <https://reviews.llvm.org/D73424>`_) +* ``R_RISCV_ALIGN`` will be errored because linker relaxation for RISC-V is not supported. + Pass ``-mno-relax`` to disable ``R_RISCV_ALIGN``. + (`D71820 <https://reviews.llvm.org/D71820>`_) +* The ARM port will no longer insert interworking thunks for non STT_FUNC symbols. + (`D73474 <https://reviews.llvm.org/D73474>`_) +* The quality of PowerPC32 port has been greatly improved (canonical PLT, copy + relocations, non-preemptible IFUNC, range extension thunks with addends). + It can link FreeBSD 13.0 userland. +* The PowerPC64 port supports non-preemptible IFUNC. + (`D71509 <https://reviews.llvm.org/D71509>`_) +* lld creates a RO PT_LOAD and a RX PT_LOAD without a linker script. + lld creates a unified RX PT_LOAD with a linker script. + A future release will eliminate this difference and use a RO PT_LOAD and a RX PT_LOAD by default. + The linker script case will require ``--no-rosegment`` to restore the current behavior. +* GNU style compressed debug sections ``.zdebug`` (obsoleted by ``SHF_COMPRESSED``) + are supported for input files, but not for the output. + A future release may drop ``.zdebug`` support. -* Reduced size of linked MIPS binaries. +Breaking changes +---------------- -COFF Improvements ------------------ +* ``-Ttext=$base`` (base is usually 0) is no longer supported. + If PT_PHDR is needed, use ``--image-base=$base`` instead. + If PT_PHDR is not needed, use a linker script with `.text 0 : { *(.text*) }` as the first + output section description. + See https://bugs.llvm.org/show_bug.cgi?id=44715 for more information. + (`D67325 <https://reviews.llvm.org/D67325>`_) +* ``-Ttext-segment`` is no longer supported. Its meaning was different from GNU ld's and + could cause subtle bugs. + (`D70468 <https://reviews.llvm.org/D70468>`_) -* ... MinGW Improvements ------------------ * Allow using custom .edata sections from input object files (for use by Wine) - (`dadc6f248868 <https://reviews.llvm.org/rGdadc6f248868>`) + (`dadc6f248868 <https://reviews.llvm.org/rGdadc6f248868>`_) * Don't implicitly create import libraries unless requested - (`6540e55067e3 <https://reviews.llvm.org/rG6540e55067e3>`) + (`6540e55067e3 <https://reviews.llvm.org/rG6540e55067e3>`_) * Support merging multiple resource object files - (`3d3a9b3b413d <https://reviews.llvm.org/rG3d3a9b3b413d>`) + (`3d3a9b3b413d <https://reviews.llvm.org/rG3d3a9b3b413d>`_) and properly handle the default manifest object files that GCC can pass - (`d581dd501381 <https://reviews.llvm.org/rGd581dd501381>`) + (`d581dd501381 <https://reviews.llvm.org/rGd581dd501381>`_) * Demangle itanium symbol names in warnings/error messages - (`a66fc1c99f3e <https://reviews.llvm.org/rGa66fc1c99f3e>`) + (`a66fc1c99f3e <https://reviews.llvm.org/rGa66fc1c99f3e>`_) * Print source locations for undefined references and duplicate symbols, if possible - (`1d06d48bb346 <https://reviews.llvm.org/rG1d06d48bb346>`) + (`1d06d48bb346 <https://reviews.llvm.org/rG1d06d48bb346>`_) and - (`b38f577c015c <https://reviews.llvm.org/rGb38f577c015c>`) + (`b38f577c015c <https://reviews.llvm.org/rGb38f577c015c>`_) * Look for more filename patterns when resolving ``-l`` options - (`0226c35262df <https://reviews.llvm.org/rG0226c35262df>`) + (`0226c35262df <https://reviews.llvm.org/rG0226c35262df>`_) * Don't error out on duplicate absolute symbols with the same value (which can happen for the default-null symbol for weak symbols) - (`1737cc750c46 <https://reviews.llvm.org/rG1737cc750c46>`) + (`1737cc750c46 <https://reviews.llvm.org/rG1737cc750c46>`_) -MachO Improvements ------------------- - -* Item 1. WebAssembly Improvements ------------------------ Modified: vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp ============================================================================== --- vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -50,7 +50,7 @@ #include <compression.h> #endif -#if LLVM_ENABLE_ZLIB +#if defined(HAVE_LIBZ) #include <zlib.h> #endif @@ -582,7 +582,7 @@ bool GDBRemoteCommunication::DecompressPacket() { } #endif -#if LLVM_ENABLE_ZLIB +#if defined(HAVE_LIBZ) if (decompressed_bytes == 0 && decompressed_bufsize != ULONG_MAX && decompressed_buffer != nullptr && m_compression_type == CompressionType::ZlibDeflate) { Modified: vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp ============================================================================== --- vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -1045,7 +1045,7 @@ void GDBRemoteCommunicationClient::MaybeEnableCompress } #endif -#if LLVM_ENABLE_ZLIB +#if defined(HAVE_LIBZ) if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "zlib-deflate") { Added: vendor/llvm-project/release-10.x/llvm/include/llvm/Support/Windows/WindowsSupport.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm-project/release-10.x/llvm/include/llvm/Support/Windows/WindowsSupport.h Thu Mar 5 18:05:37 2020 (r358679) @@ -0,0 +1,243 @@ +//===- WindowsSupport.h - Common Windows Include File -----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines things specific to Windows implementations. In addition to +// providing some helpers for working with win32 APIs, this header wraps +// <windows.h> with some portability macros. Always include WindowsSupport.h +// instead of including <windows.h> directly. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +//=== WARNING: Implementation here must contain only generic Win32 code that +//=== is guaranteed to work on *all* Win32 variants. +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_WINDOWSSUPPORT_H +#define LLVM_SUPPORT_WINDOWSSUPPORT_H + +// mingw-w64 tends to define it as 0x0502 in its headers. +#undef _WIN32_WINNT +#undef _WIN32_IE + +// Require at least Windows 7 API. +#define _WIN32_WINNT 0x0601 +#define _WIN32_IE 0x0800 // MinGW at it again. FIXME: verify if still needed. +#define WIN32_LEAN_AND_MEAN +#ifndef NOMINMAX +#define NOMINMAX +#endif + +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Config/config.h" // Get build system configuration settings +#include "llvm/Support/Allocator.h" +#include "llvm/Support/Chrono.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/VersionTuple.h" +#include <cassert> +#include <string> +#include <system_error> +#include <windows.h> + +// Must be included after windows.h +#include <wincrypt.h> + +namespace llvm { + +/// Determines if the program is running on Windows 8 or newer. This +/// reimplements one of the helpers in the Windows 8.1 SDK, which are intended +/// to supercede raw calls to GetVersionEx. Old SDKs, Cygwin, and MinGW don't +/// yet have VersionHelpers.h, so we have our own helper. +bool RunningWindows8OrGreater(); + +/// Returns the Windows version as Major.Minor.0.BuildNumber. Uses +/// RtlGetVersion or GetVersionEx under the hood depending on what is available. +/// GetVersionEx is deprecated, but this API exposes the build number which can +/// be useful for working around certain kernel bugs. +llvm::VersionTuple GetWindowsOSVersion(); + +bool MakeErrMsg(std::string *ErrMsg, const std::string &prefix); + +// Include GetLastError() in a fatal error message. +LLVM_ATTRIBUTE_NORETURN inline void ReportLastErrorFatal(const char *Msg) { + std::string ErrMsg; + MakeErrMsg(&ErrMsg, Msg); + llvm::report_fatal_error(ErrMsg); +} + +template <typename HandleTraits> +class ScopedHandle { + typedef typename HandleTraits::handle_type handle_type; + handle_type Handle; + + ScopedHandle(const ScopedHandle &other) = delete; + void operator=(const ScopedHandle &other) = delete; +public: + ScopedHandle() + : Handle(HandleTraits::GetInvalid()) {} + + explicit ScopedHandle(handle_type h) + : Handle(h) {} + + ~ScopedHandle() { + if (HandleTraits::IsValid(Handle)) + HandleTraits::Close(Handle); + } + + handle_type take() { + handle_type t = Handle; + Handle = HandleTraits::GetInvalid(); + return t; + } + + ScopedHandle &operator=(handle_type h) { + if (HandleTraits::IsValid(Handle)) + HandleTraits::Close(Handle); + Handle = h; + return *this; + } + + // True if Handle is valid. + explicit operator bool() const { + return HandleTraits::IsValid(Handle) ? true : false; + } + + operator handle_type() const { + return Handle; + } +}; + +struct CommonHandleTraits { + typedef HANDLE handle_type; + + static handle_type GetInvalid() { + return INVALID_HANDLE_VALUE; + } + + static void Close(handle_type h) { + ::CloseHandle(h); + } + + static bool IsValid(handle_type h) { + return h != GetInvalid(); + } +}; + +struct JobHandleTraits : CommonHandleTraits { + static handle_type GetInvalid() { + return NULL; + } +}; + +struct CryptContextTraits : CommonHandleTraits { + typedef HCRYPTPROV handle_type; + + static handle_type GetInvalid() { + return 0; + } + + static void Close(handle_type h) { + ::CryptReleaseContext(h, 0); + } + + static bool IsValid(handle_type h) { + return h != GetInvalid(); + } +}; + +struct RegTraits : CommonHandleTraits { + typedef HKEY handle_type; + + static handle_type GetInvalid() { + return NULL; + } + + static void Close(handle_type h) { + ::RegCloseKey(h); + } + + static bool IsValid(handle_type h) { + return h != GetInvalid(); + } +}; + +struct FindHandleTraits : CommonHandleTraits { + static void Close(handle_type h) { + ::FindClose(h); + } +}; + +struct FileHandleTraits : CommonHandleTraits {}; + +typedef ScopedHandle<CommonHandleTraits> ScopedCommonHandle; +typedef ScopedHandle<FileHandleTraits> ScopedFileHandle; +typedef ScopedHandle<CryptContextTraits> ScopedCryptContext; +typedef ScopedHandle<RegTraits> ScopedRegHandle; +typedef ScopedHandle<FindHandleTraits> ScopedFindHandle; +typedef ScopedHandle<JobHandleTraits> ScopedJobHandle; + +template <class T> +class SmallVectorImpl; + +template <class T> +typename SmallVectorImpl<T>::const_pointer +c_str(SmallVectorImpl<T> &str) { + str.push_back(0); + str.pop_back(); + return str.data(); +} + +namespace sys { + +inline std::chrono::nanoseconds toDuration(FILETIME Time) { + ULARGE_INTEGER TimeInteger; + TimeInteger.LowPart = Time.dwLowDateTime; + TimeInteger.HighPart = Time.dwHighDateTime; + + // FILETIME's are # of 100 nanosecond ticks (1/10th of a microsecond) + return std::chrono::nanoseconds(100 * TimeInteger.QuadPart); +} + +inline TimePoint<> toTimePoint(FILETIME Time) { + ULARGE_INTEGER TimeInteger; + TimeInteger.LowPart = Time.dwLowDateTime; + TimeInteger.HighPart = Time.dwHighDateTime; + + // Adjust for different epoch + TimeInteger.QuadPart -= 11644473600ll * 10000000; + + // FILETIME's are # of 100 nanosecond ticks (1/10th of a microsecond) + return TimePoint<>(std::chrono::nanoseconds(100 * TimeInteger.QuadPart)); +} + +inline FILETIME toFILETIME(TimePoint<> TP) { + ULARGE_INTEGER TimeInteger; + TimeInteger.QuadPart = TP.time_since_epoch().count() / 100; + TimeInteger.QuadPart += 11644473600ll * 10000000; + + FILETIME Time; + Time.dwLowDateTime = TimeInteger.LowPart; + Time.dwHighDateTime = TimeInteger.HighPart; + return Time; +} + +namespace windows { +// Returns command line arguments. Unlike arguments given to main(), +// this function guarantees that the returned arguments are encoded in +// UTF-8 regardless of the current code page setting. +std::error_code GetCommandLineArguments(SmallVectorImpl<const char *> &Args, + BumpPtrAllocator &Alloc); +} // end namespace windows +} // end namespace sys +} // end namespace llvm. + +#endif Modified: vendor/llvm-project/release-10.x/llvm/include/llvm/module.modulemap ============================================================================== --- vendor/llvm-project/release-10.x/llvm/include/llvm/module.modulemap Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/include/llvm/module.modulemap Thu Mar 5 18:05:37 2020 (r358679) @@ -380,6 +380,9 @@ module LLVM_Utils { umbrella "Support" module * { export * } + + // Exclude this; it should only be used on Windows. + exclude header "Support/Windows/WindowsSupport.h" // Exclude these; they are fundamentally non-modular. exclude header "Support/PluginLoader.h" Modified: vendor/llvm-project/release-10.x/llvm/lib/Analysis/TargetLibraryInfo.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Analysis/TargetLibraryInfo.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Analysis/TargetLibraryInfo.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -470,6 +470,9 @@ static void initialize(TargetLibraryInfoImpl &TLI, con TLI.setUnavailable(LibFunc_tmpfile64); // Relaxed math functions are included in math-finite.h on Linux (GLIBC). + // Note that math-finite.h is no longer supported by top-of-tree GLIBC, + // so we keep these functions around just so that they're recognized by + // the ConstantFolder. TLI.setUnavailable(LibFunc_acos_finite); TLI.setUnavailable(LibFunc_acosf_finite); TLI.setUnavailable(LibFunc_acosl_finite); Modified: vendor/llvm-project/release-10.x/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -3867,7 +3867,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode SmallVector<SDValue, 8> Results; SDLoc dl(Node); // FIXME: Check flags on the node to see if we can use a finite call. - bool CanUseFiniteLibCall = TM.Options.NoInfsFPMath && TM.Options.NoNaNsFPMath; unsigned Opc = Node->getOpcode(); switch (Opc) { case ISD::ATOMIC_FENCE: { @@ -3976,68 +3975,28 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode break; case ISD::FLOG: case ISD::STRICT_FLOG: - if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_log_finite)) - ExpandFPLibCall(Node, RTLIB::LOG_FINITE_F32, - RTLIB::LOG_FINITE_F64, - RTLIB::LOG_FINITE_F80, - RTLIB::LOG_FINITE_F128, - RTLIB::LOG_FINITE_PPCF128, Results); - else - ExpandFPLibCall(Node, RTLIB::LOG_F32, RTLIB::LOG_F64, - RTLIB::LOG_F80, RTLIB::LOG_F128, - RTLIB::LOG_PPCF128, Results); + ExpandFPLibCall(Node, RTLIB::LOG_F32, RTLIB::LOG_F64, RTLIB::LOG_F80, + RTLIB::LOG_F128, RTLIB::LOG_PPCF128, Results); break; case ISD::FLOG2: case ISD::STRICT_FLOG2: - if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_log2_finite)) - ExpandFPLibCall(Node, RTLIB::LOG2_FINITE_F32, - RTLIB::LOG2_FINITE_F64, - RTLIB::LOG2_FINITE_F80, - RTLIB::LOG2_FINITE_F128, - RTLIB::LOG2_FINITE_PPCF128, Results); - else - ExpandFPLibCall(Node, RTLIB::LOG2_F32, RTLIB::LOG2_F64, - RTLIB::LOG2_F80, RTLIB::LOG2_F128, - RTLIB::LOG2_PPCF128, Results); + ExpandFPLibCall(Node, RTLIB::LOG2_F32, RTLIB::LOG2_F64, RTLIB::LOG2_F80, + RTLIB::LOG2_F128, RTLIB::LOG2_PPCF128, Results); break; case ISD::FLOG10: case ISD::STRICT_FLOG10: - if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_log10_finite)) - ExpandFPLibCall(Node, RTLIB::LOG10_FINITE_F32, - RTLIB::LOG10_FINITE_F64, - RTLIB::LOG10_FINITE_F80, - RTLIB::LOG10_FINITE_F128, - RTLIB::LOG10_FINITE_PPCF128, Results); - else - ExpandFPLibCall(Node, RTLIB::LOG10_F32, RTLIB::LOG10_F64, - RTLIB::LOG10_F80, RTLIB::LOG10_F128, - RTLIB::LOG10_PPCF128, Results); + ExpandFPLibCall(Node, RTLIB::LOG10_F32, RTLIB::LOG10_F64, RTLIB::LOG10_F80, + RTLIB::LOG10_F128, RTLIB::LOG10_PPCF128, Results); break; case ISD::FEXP: case ISD::STRICT_FEXP: - if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_exp_finite)) - ExpandFPLibCall(Node, RTLIB::EXP_FINITE_F32, - RTLIB::EXP_FINITE_F64, - RTLIB::EXP_FINITE_F80, - RTLIB::EXP_FINITE_F128, - RTLIB::EXP_FINITE_PPCF128, Results); - else - ExpandFPLibCall(Node, RTLIB::EXP_F32, RTLIB::EXP_F64, - RTLIB::EXP_F80, RTLIB::EXP_F128, - RTLIB::EXP_PPCF128, Results); + ExpandFPLibCall(Node, RTLIB::EXP_F32, RTLIB::EXP_F64, RTLIB::EXP_F80, + RTLIB::EXP_F128, RTLIB::EXP_PPCF128, Results); break; case ISD::FEXP2: case ISD::STRICT_FEXP2: - if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_exp2_finite)) - ExpandFPLibCall(Node, RTLIB::EXP2_FINITE_F32, - RTLIB::EXP2_FINITE_F64, - RTLIB::EXP2_FINITE_F80, - RTLIB::EXP2_FINITE_F128, - RTLIB::EXP2_FINITE_PPCF128, Results); - else - ExpandFPLibCall(Node, RTLIB::EXP2_F32, RTLIB::EXP2_F64, - RTLIB::EXP2_F80, RTLIB::EXP2_F128, - RTLIB::EXP2_PPCF128, Results); + ExpandFPLibCall(Node, RTLIB::EXP2_F32, RTLIB::EXP2_F64, RTLIB::EXP2_F80, + RTLIB::EXP2_F128, RTLIB::EXP2_PPCF128, Results); break; case ISD::FTRUNC: case ISD::STRICT_FTRUNC: @@ -4107,16 +4066,8 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode } case ISD::FPOW: case ISD::STRICT_FPOW: - if (CanUseFiniteLibCall && DAG.getLibInfo().has(LibFunc_pow_finite)) - ExpandFPLibCall(Node, RTLIB::POW_FINITE_F32, - RTLIB::POW_FINITE_F64, - RTLIB::POW_FINITE_F80, - RTLIB::POW_FINITE_F128, - RTLIB::POW_FINITE_PPCF128, Results); - else - ExpandFPLibCall(Node, RTLIB::POW_F32, RTLIB::POW_F64, - RTLIB::POW_F80, RTLIB::POW_F128, - RTLIB::POW_PPCF128, Results); + ExpandFPLibCall(Node, RTLIB::POW_F32, RTLIB::POW_F64, RTLIB::POW_F80, + RTLIB::POW_F128, RTLIB::POW_PPCF128, Results); break; case ISD::LROUND: case ISD::STRICT_LROUND: Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/CRC.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/CRC.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/CRC.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -25,7 +25,7 @@ using namespace llvm; -#if !LLVM_ENABLE_ZLIB +#if LLVM_ENABLE_ZLIB == 0 || !HAVE_ZLIB_H static const uint32_t CRCTable[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Compression.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Compression.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Compression.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -17,13 +17,13 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include "llvm/Support/ErrorHandling.h" -#if LLVM_ENABLE_ZLIB +#if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H #include <zlib.h> #endif using namespace llvm; -#if LLVM_ENABLE_ZLIB +#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ static Error createError(StringRef Err) { return make_error<StringError>(Err, inconvertibleErrorCode()); } Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/CrashRecoveryContext.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/CrashRecoveryContext.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/CrashRecoveryContext.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -254,7 +254,7 @@ bool CrashRecoveryContext::RunSafely(function_ref<void // XP, so if support for older versions of Windows is required, // it will have to be added. -#include "Windows/WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" static LONG CALLBACK ExceptionHandler(PEXCEPTION_POINTERS ExceptionInfo) { Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/InitLLVM.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/InitLLVM.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/InitLLVM.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -15,7 +15,7 @@ #include <string> #ifdef _WIN32 -#include "Windows/WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #endif using namespace llvm; Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/RandomNumberGenerator.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/RandomNumberGenerator.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/RandomNumberGenerator.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -17,7 +17,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #ifdef _WIN32 -#include "Windows/WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #else #include "Unix/Unix.h" #endif Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/DynamicLibrary.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/DynamicLibrary.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/DynamicLibrary.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #include "llvm/Support/ConvertUTF.h" #include "llvm/Support/raw_ostream.h" Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Host.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Host.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Host.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #include <cstdio> #include <string> Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Memory.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Memory.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Memory.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -17,7 +17,7 @@ #include "llvm/Support/WindowsError.h" // The Windows.h header must be the last one included. -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" static DWORD getWindowsProtectionFlags(unsigned Flags) { switch (Flags & llvm::sys::Memory::MF_RWE_MASK) { Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Path.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Path.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Path.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -25,7 +25,7 @@ // These two headers must be included last, and make sure shlobj is required // after Windows.h to make sure it picks up our definition of _WIN32_WINNT -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #include <shellapi.h> #include <shlobj.h> Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Process.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Process.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Process.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -19,7 +19,7 @@ #include <malloc.h> // The Windows.h header must be after LLVM and standard headers. -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #include <direct.h> #include <io.h> Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Program.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Program.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Program.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/ConvertUTF.h" #include "llvm/Support/Errc.h" Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Signals.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Signals.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Signals.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -23,7 +23,7 @@ #include "llvm/Support/raw_ostream.h" // The Windows.h header must be after LLVM and standard headers. -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #ifdef __MINGW32__ #include <imagehlp.h> Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/ThreadLocal.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/ThreadLocal.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/ThreadLocal.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -15,7 +15,7 @@ //=== is guaranteed to work on *all* Win32 variants. //===----------------------------------------------------------------------===// -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #include "llvm/Support/ThreadLocal.h" namespace llvm { Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Threading.inc ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Threading.inc Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/Windows/Threading.inc Thu Mar 5 18:05:37 2020 (r358679) @@ -13,7 +13,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" -#include "WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #include <process.h> // Windows will at times define MemoryFence. Modified: vendor/llvm-project/release-10.x/llvm/lib/Support/raw_ostream.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Support/raw_ostream.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Support/raw_ostream.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -60,7 +60,7 @@ #ifdef _WIN32 #include "llvm/Support/ConvertUTF.h" -#include "Windows/WindowsSupport.h" +#include "llvm/Support/Windows/WindowsSupport.h" #endif using namespace llvm; Modified: vendor/llvm-project/release-10.x/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -218,13 +218,21 @@ Instruction *InstCombiner::FoldIntegerTypedPHI(PHINode return nullptr; // If any of the operand that requires casting is a terminator - // instruction, do not do it. + // instruction, do not do it. Similarly, do not do the transform if the value + // is PHI in a block with no insertion point, for example, a catchswitch + // block, since we will not be able to insert a cast after the PHI. if (any_of(AvailablePtrVals, [&](Value *V) { if (V->getType() == IntToPtr->getType()) return false; - auto *Inst = dyn_cast<Instruction>(V); - return Inst && Inst->isTerminator(); + if (!Inst) + return false; + if (Inst->isTerminator()) + return true; + auto *BB = Inst->getParent(); + if (isa<PHINode>(Inst) && BB->getFirstInsertionPt() == BB->end()) + return true; + return false; })) return nullptr; @@ -264,8 +272,10 @@ Instruction *InstCombiner::FoldIntegerTypedPHI(PHINode if (auto *IncomingI = dyn_cast<Instruction>(IncomingVal)) { BasicBlock::iterator InsertPos(IncomingI); InsertPos++; + BasicBlock *BB = IncomingI->getParent(); if (isa<PHINode>(IncomingI)) - InsertPos = IncomingI->getParent()->getFirstInsertionPt(); + InsertPos = BB->getFirstInsertionPt(); + assert(InsertPos != BB->end() && "should have checked above"); InsertNewInstBefore(CI, *InsertPos); } else { auto *InsertBB = &IncomingBB->getParent()->getEntryBlock(); Modified: vendor/llvm-project/release-10.x/llvm/lib/Transforms/Scalar/SROA.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/lib/Transforms/Scalar/SROA.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/lib/Transforms/Scalar/SROA.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -2519,6 +2519,8 @@ class llvm::sroa::AllocaSliceRewriter (private) NewLI->setAAMetadata(AATags); if (LI.isVolatile()) NewLI->setAtomic(LI.getOrdering(), LI.getSyncScopeID()); + if (NewLI->isAtomic()) + NewLI->setAlignment(LI.getAlign()); // Any !nonnull metadata or !range metadata on the old load is also valid // on the new load. This is even true in some cases even when the loads @@ -2709,6 +2711,8 @@ class llvm::sroa::AllocaSliceRewriter (private) NewSI->setAAMetadata(AATags); if (SI.isVolatile()) NewSI->setAtomic(SI.getOrdering(), SI.getSyncScopeID()); + if (NewSI->isAtomic()) + NewSI->setAlignment(SI.getAlign()); Pass.DeadInsts.insert(&SI); deleteIfTriviallyDead(OldOp); Modified: vendor/llvm-project/release-10.x/llvm/tools/llvm-ar/llvm-ar.cpp ============================================================================== --- vendor/llvm-project/release-10.x/llvm/tools/llvm-ar/llvm-ar.cpp Thu Mar 5 17:55:36 2020 (r358678) +++ vendor/llvm-project/release-10.x/llvm/tools/llvm-ar/llvm-ar.cpp Thu Mar 5 18:05:37 2020 (r358679) @@ -45,8 +45,7 @@ #endif #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include <windows.h> +#include "llvm/Support/Windows/WindowsSupport.h" #endif using namespace llvm;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003051805.025I5cRl078190>