From nobody Sun Jan 07 17:50:27 2024 X-Original-To: dev-commits-src-all@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 4T7PqS3TSnz55X7T; Sun, 7 Jan 2024 17:50:28 +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 4T7PqS0Vt2z4MS9; Sun, 7 Jan 2024 17:50:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704649828; 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=+BwBq+n0g8GGq7elXxwL+aG2Mq3T5g0NJEC0arkmb5U=; b=JjJpn2OhvFKWRJi8uM0XtK8y941xqOUbNdCB7cSFNrk2DokR+t+R2z+VPIVj0veUYDbPgd aliQrFNNIpxpLK4nz3zUnvvaSVt9Se4ptlCZMDVKBBfhpyubCnLu9zK+mPw+QETjH78XGP tov7KWKNeZ6dnsdzSxivC2uVl8BGYhhebi2HuMmiVyu2lBqNeNdor9jlqn88FEbslOInbs VzKVewkBIj4mIFB7CRNqyzf6romLOlsV+XCoMxgQz2pA086g4hG5z9EHQgZ5nM9K8ghReV dDpzteXZTRvuu1GX+FYj8GZ66DWmAHolum3c1MMdpcA61xE39rhraGpVnKH4ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704649828; 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=+BwBq+n0g8GGq7elXxwL+aG2Mq3T5g0NJEC0arkmb5U=; b=YolUPc+gT8SRBGvBPs54s0cY5c2HI64t3qmCzGJeovxavXXPQ+881QYz1TCP8ks2IeLUcs caTTTRvvus4o/LNPAd+yCo25MxQrfZ+cWgJIKa1jqN6KnRRovFrahabOsqsel5/hgMmeAB fEr2/zIRCIOWTjkEqGh0EpQhCmUPKAQKCsHyVynnZNr7lFqgjnw4J6OChv/GbJ7IXc5xax bWPoNGIyBH+J/8rkCRTYf4cvXVdMRaMycwts6xa4tTIZwcubvkfi/KT6Pa1BFoEwHpiIQs ekDMiSvumHIo4vKPtgcYVW4ZHbu6QdEMG3NhNFeAFQw7rBDYo2umxhZfxEpjiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704649828; a=rsa-sha256; cv=none; b=Q58+pEO7vIvSMgPsPWveTejJpU4TFZwlHRKlbxqjp/9iaPp+9c21AamUiFBBmQMvYIJNTg n50Py8I6cn5VMcmzIFhOLziAQpV9zpws6mJzEsrgRVzlIOJDSxx+aeE/KgH/X/oM2F0XdF K1HLVG04Jvi6YXhqA60UgL/4G5Ku4yVvT6Gg2A6T3Fs+WRIiPT60G9bWj/DElzM5Z2sz+x UGc9ZWxU4YaQ4ZiXeEHiM77UDgEgagyC+HWW+g3/5AcocZJ+bAMpfbEBRkhnKPG2TNJ/xz R2qbg1PHB4pFbVAjL3AT5TOO9bOrFBAkOt4c+5S2OC1hZ2jqS9AFipuwEBHjbA== 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 4T7PqR6dz8zZDB; Sun, 7 Jan 2024 17:50:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 407HoRXJ022011; Sun, 7 Jan 2024 17:50:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 407HoRp2022008; Sun, 7 Jan 2024 17:50:27 GMT (envelope-from git) Date: Sun, 7 Jan 2024 17:50:27 GMT Message-Id: <202401071750.407HoRp2022008@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: c25d8933a86a - stable/14 - Merge llvm-project release/17.x llvmorg-17.0.3-0-g888437e1b600 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/14 X-Git-Reftype: branch X-Git-Commit: c25d8933a86ad2ca82d38a2d8a1f1f7c1fc1e2f4 Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=c25d8933a86ad2ca82d38a2d8a1f1f7c1fc1e2f4 commit c25d8933a86ad2ca82d38a2d8a1f1f7c1fc1e2f4 Author: Dimitry Andric AuthorDate: 2023-10-21 13:31:11 +0000 Commit: Dimitry Andric CommitDate: 2024-01-07 17:46:18 +0000 Merge llvm-project release/17.x llvmorg-17.0.3-0-g888437e1b600 This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-17.0.3-0-g888437e1b600. PR: 273753 MFC after: 1 month (cherry picked from commit bdb86d1a853a919764f65fdedcea76d76e4d619b) --- .../clang/lib/Driver/ToolChains/MinGW.cpp | 2 + .../clang/lib/Format/UnwrappedLineParser.cpp | 24 +++++++++ .../clang/lib/Format/UnwrappedLineParser.h | 11 ++++ .../llvm-project/clang/lib/Sema/SemaChecking.cpp | 25 +++++---- .../clang/utils/TableGen/ClangAttrEmitter.cpp | 17 +++--- contrib/llvm-project/libcxx/include/__config | 2 +- contrib/llvm-project/lld/COFF/InputFiles.cpp | 2 + .../llvm/lib/Analysis/LazyValueInfo.cpp | 2 +- contrib/llvm-project/llvm/lib/MC/MCWin64EH.cpp | 3 ++ .../lib/Target/AArch64/AArch64ISelLowering.cpp | 7 ++- .../llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 2 +- .../llvm/lib/Target/X86/X86ISelLowering.cpp | 21 ++++++-- .../Instrumentation/AddressSanitizer.cpp | 61 ++++++++++++---------- lib/clang/include/VCSVersion.inc | 6 +-- lib/clang/include/clang/Basic/Version.inc | 6 +-- 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 +- 20 files changed, 139 insertions(+), 70 deletions(-) diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.cpp index eaec1d22e6e5..503dbf3f0dea 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.cpp @@ -699,6 +699,8 @@ void toolchains::MinGW::addClangTargetOptions( } } + CC1Args.push_back("-fno-use-init-array"); + for (auto Opt : {options::OPT_mthreads, options::OPT_mwindows, options::OPT_mconsole, options::OPT_mdll}) { if (Arg *A = DriverArgs.getLastArgNoClaim(Opt)) diff --git a/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp b/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp index 852437b9390f..07ff86bc50a2 100644 --- a/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp +++ b/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp @@ -173,10 +173,12 @@ void UnwrappedLineParser::reset() { CommentsBeforeNextToken.clear(); FormatTok = nullptr; MustBreakBeforeNextToken = false; + IsDecltypeAutoFunction = false; PreprocessorDirectives.clear(); CurrentLines = &Lines; DeclarationScopeStack.clear(); NestedTooDeep.clear(); + NestedLambdas.clear(); PPStack.clear(); Line->FirstStartColumn = FirstStartColumn; @@ -1757,6 +1759,17 @@ void UnwrappedLineParser::parseStructuralElement( if (parseStructLike()) return; break; + case tok::kw_decltype: + nextToken(); + if (FormatTok->is(tok::l_paren)) { + parseParens(); + assert(FormatTok->Previous); + if (FormatTok->Previous->endsSequence(tok::r_paren, tok::kw_auto, + tok::l_paren)) { + Line->SeenDecltypeAuto = true; + } + } + break; case tok::period: nextToken(); // In Java, classes have an implicit static member "class". @@ -1818,6 +1831,7 @@ void UnwrappedLineParser::parseStructuralElement( if (NextLBracesType != TT_Unknown) FormatTok->setFinalizedType(NextLBracesType); if (!tryToParsePropertyAccessor() && !tryToParseBracedList()) { + IsDecltypeAutoFunction = Line->SeenDecltypeAuto; // A block outside of parentheses must be the last part of a // structural element. // FIXME: Figure out cases where this is not true, and add projections @@ -1835,6 +1849,7 @@ void UnwrappedLineParser::parseStructuralElement( } FormatTok->setFinalizedType(TT_FunctionLBrace); parseBlock(); + IsDecltypeAutoFunction = false; addUnwrappedLine(); return; } @@ -2249,9 +2264,15 @@ bool UnwrappedLineParser::tryToParseLambda() { return true; } } + FormatTok->setFinalizedType(TT_LambdaLBrace); LSquare.setFinalizedType(TT_LambdaLSquare); + + NestedLambdas.push_back(Line->SeenDecltypeAuto); parseChildBlock(); + assert(!NestedLambdas.empty()); + NestedLambdas.pop_back(); + return true; } @@ -2471,6 +2492,8 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType) { PrevPrev->endsSequence(tok::kw_constexpr, tok::kw_if)))); const bool ReturnParens = Style.RemoveParentheses == FormatStyle::RPS_ReturnStatement && + ((NestedLambdas.empty() && !IsDecltypeAutoFunction) || + (!NestedLambdas.empty() && !NestedLambdas.back())) && Prev && Prev->isOneOf(tok::kw_return, tok::kw_co_return) && Next && Next->is(tok::semi); if ((DoubleParens && !Blacklisted) || ReturnParens) { @@ -4386,6 +4409,7 @@ void UnwrappedLineParser::addUnwrappedLine(LineLevel AdjustLevel) { Line->MatchingOpeningBlockLineIndex = UnwrappedLine::kInvalidIndex; Line->FirstStartColumn = 0; Line->IsContinuation = false; + Line->SeenDecltypeAuto = false; if (ClosesWhitesmithsBlock && AdjustLevel == LineLevel::Remove) --Line->Level; diff --git a/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.h b/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.h index 57515af64a3e..96248d130ddb 100644 --- a/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.h +++ b/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.h @@ -61,6 +61,9 @@ struct UnwrappedLine { bool MustBeDeclaration; + /// Whether the parser has seen \c decltype(auto) in this line. + bool SeenDecltypeAuto = false; + /// \c True if this line should be indented by ContinuationIndent in /// addition to the normal indention level. bool IsContinuation = false; @@ -341,6 +344,14 @@ private: // statement contains more than some predefined number of nested statements). SmallVector NestedTooDeep; + // Keeps a stack of the states of nested lambdas (true if the return type of + // the lambda is `decltype(auto)`). + SmallVector NestedLambdas; + + // Whether the parser is parsing the body of a function whose return type is + // `decltype(auto)`. + bool IsDecltypeAutoFunction = false; + // Represents preprocessor branch type, so we can find matching // #if/#else/#endif directives. enum PPBranchKind { diff --git a/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp b/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp index 8626fc6ea16f..a94f009f3fa6 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaChecking.cpp @@ -11166,12 +11166,15 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, ImplicitMatch == ArgType::NoMatchTypeConfusion) Match = ImplicitMatch; assert(Match != ArgType::MatchPromotion); + // Look through unscoped enums to their underlying type. bool IsEnum = false; bool IsScopedEnum = false; + QualType IntendedTy = ExprTy; if (auto EnumTy = ExprTy->getAs()) { + IntendedTy = EnumTy->getDecl()->getIntegerType(); if (EnumTy->isUnscopedEnumerationType()) { - ExprTy = EnumTy->getDecl()->getIntegerType(); + ExprTy = IntendedTy; // This controls whether we're talking about the underlying type or not, // which we only want to do when it's an unscoped enum. IsEnum = true; @@ -11183,7 +11186,6 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, // %C in an Objective-C context prints a unichar, not a wchar_t. // If the argument is an integer of some kind, believe the %C and suggest // a cast instead of changing the conversion specifier. - QualType IntendedTy = ExprTy; if (isObjCContext() && FS.getConversionSpecifier().getKind() == ConversionSpecifier::CArg) { if (ExprTy->isIntegralOrUnscopedEnumerationType() && @@ -11219,8 +11221,10 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, std::tie(CastTy, CastTyName) = shouldNotPrintDirectly(S.Context, IntendedTy, E); if (!CastTy.isNull()) { // %zi/%zu and %td/%tu are OK to use for NSInteger/NSUInteger of type int - // (long in ASTContext). Only complain to pedants. - if ((CastTyName == "NSInteger" || CastTyName == "NSUInteger") && + // (long in ASTContext). Only complain to pedants or when they're the + // underlying type of a scoped enum (which always needs a cast). + if (!IsScopedEnum && + (CastTyName == "NSInteger" || CastTyName == "NSUInteger") && (AT.isSizeT() || AT.isPtrdiffT()) && AT.matchesType(S.Context, CastTy)) Match = ArgType::NoMatchPedantic; @@ -11275,20 +11279,15 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, // should be printed as 'long' for 64-bit compatibility.) // Rather than emitting a normal format/argument mismatch, we want to // add a cast to the recommended type (and correct the format string - // if necessary). + // if necessary). We should also do so for scoped enumerations. SmallString<16> CastBuf; llvm::raw_svector_ostream CastFix(CastBuf); CastFix << (S.LangOpts.CPlusPlus ? "static_cast<" : "("); - if (IsScopedEnum) { - CastFix << AT.getRepresentativeType(S.Context).getAsString( - S.Context.getPrintingPolicy()); - } else { - IntendedTy.print(CastFix, S.Context.getPrintingPolicy()); - } + IntendedTy.print(CastFix, S.Context.getPrintingPolicy()); CastFix << (S.LangOpts.CPlusPlus ? ">" : ")"); SmallVector Hints; - if ((!AT.matchesType(S.Context, IntendedTy) && !IsScopedEnum) || + if (AT.matchesType(S.Context, IntendedTy) != ArgType::Match || ShouldNotPrintDirectly) Hints.push_back(FixItHint::CreateReplacement(SpecRange, os.str())); @@ -11316,7 +11315,7 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, Hints.push_back(FixItHint::CreateInsertion(After, ")")); } - if (ShouldNotPrintDirectly) { + if (ShouldNotPrintDirectly && !IsScopedEnum) { // The expression has a type that should not be printed directly. // We extract the name from the typedef because we don't want to show // the underlying type in the diagnostic. diff --git a/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp b/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp index 8ef728f86c6b..b5813c6abc2b 100644 --- a/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp +++ b/contrib/llvm-project/clang/utils/TableGen/ClangAttrEmitter.cpp @@ -2639,7 +2639,8 @@ static void emitAttributes(RecordKeeper &Records, raw_ostream &OS, OS << ", "; emitFormInitializer(OS, Spellings[0], "0"); } else { - OS << ", (\n"; + OS << ", [&]() {\n"; + OS << " switch (S) {\n"; std::set Uniques; unsigned Idx = 0; for (auto I = Spellings.begin(), E = Spellings.end(); I != E; @@ -2647,15 +2648,19 @@ static void emitAttributes(RecordKeeper &Records, raw_ostream &OS, const FlattenedSpelling &S = *I; const auto &Name = SemanticToSyntacticMap[Idx]; if (Uniques.insert(Name).second) { - OS << " S == " << Name << " ? AttributeCommonInfo::Form"; + OS << " case " << Name << ":\n"; + OS << " return AttributeCommonInfo::Form"; emitFormInitializer(OS, S, Name); - OS << " :\n"; + OS << ";\n"; } } - OS << " (llvm_unreachable(\"Unknown attribute spelling!\"), " - << " AttributeCommonInfo::Form"; + OS << " default:\n"; + OS << " llvm_unreachable(\"Unknown attribute spelling!\");\n" + << " return AttributeCommonInfo::Form"; emitFormInitializer(OS, Spellings[0], "0"); - OS << "))"; + OS << ";\n" + << " }\n" + << " }()"; } OS << ");\n"; diff --git a/contrib/llvm-project/libcxx/include/__config b/contrib/llvm-project/libcxx/include/__config index c37d643414aa..3859c027cd29 100644 --- a/contrib/llvm-project/libcxx/include/__config +++ b/contrib/llvm-project/libcxx/include/__config @@ -40,7 +40,7 @@ // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 17.0.1 == 17.00.01), _LIBCPP_VERSION is // defined to XXYYZZ. -# define _LIBCPP_VERSION 170002 +# define _LIBCPP_VERSION 170003 # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) diff --git a/contrib/llvm-project/lld/COFF/InputFiles.cpp b/contrib/llvm-project/lld/COFF/InputFiles.cpp index 541837a7fcec..a7a08fb2fa6e 100644 --- a/contrib/llvm-project/lld/COFF/InputFiles.cpp +++ b/contrib/llvm-project/lld/COFF/InputFiles.cpp @@ -661,6 +661,8 @@ std::optional ObjFile::createDefined( if (prevailing) { SectionChunk *c = readSection(sectionNumber, def, getName()); sparseChunks[sectionNumber] = c; + if (!c) + return nullptr; c->sym = cast(leader); c->selection = selection; cast(leader)->data = &c->repl; diff --git a/contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp b/contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp index 2ba6036056d9..b66c2378b72a 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/LazyValueInfo.cpp @@ -804,7 +804,7 @@ void LazyValueInfoImpl::intersectAssumeOrGuardBlockValueConstantRange( static ConstantRange getConstantRangeOrFull(const ValueLatticeElement &Val, Type *Ty, const DataLayout &DL) { - if (Val.isConstantRange()) + if (Val.isConstantRange(/*UndefAllowed*/ false)) return Val.getConstantRange(); return ConstantRange::getFull(DL.getTypeSizeInBits(Ty)); } diff --git a/contrib/llvm-project/llvm/lib/MC/MCWin64EH.cpp b/contrib/llvm-project/llvm/lib/MC/MCWin64EH.cpp index a2d61da722af..bb3492bec8aa 100644 --- a/contrib/llvm-project/llvm/lib/MC/MCWin64EH.cpp +++ b/contrib/llvm-project/llvm/lib/MC/MCWin64EH.cpp @@ -1402,6 +1402,9 @@ static void ARM64EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info, // here, but we'd have to emit the pdata, the xdata header, and the // epilogue scopes later, since they depend on whether the we need to // split the unwind data. + // + // If this is fixed, remove code in AArch64ISelLowering.cpp that + // disables loop alignment on Windows. RawFuncLength = GetAbsDifference(streamer, info->FuncletOrFuncEnd, info->Begin); } diff --git a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index a1753a40a117..6e721b937846 100644 --- a/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -1033,7 +1033,12 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM, // Set required alignment. setMinFunctionAlignment(Align(4)); // Set preferred alignments. - setPrefLoopAlignment(STI.getPrefLoopAlignment()); + + // Don't align loops on Windows. The SEH unwind info generation needs to + // know the exact length of functions before the alignments have been + // expanded. + if (!Subtarget->isTargetWindows()) + setPrefLoopAlignment(STI.getPrefLoopAlignment()); setMaxBytesForAlignment(STI.getMaxBytesForLoopAlignment()); setPrefFunctionAlignment(STI.getPrefFunctionAlignment()); diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp index 819722360e33..547b71a6101a 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -15529,7 +15529,7 @@ SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N, break; SDValue ConstOp = DAG.getConstant(Imm, dl, MVT::i32); SDValue NarrowAnd = DAG.getNode(ISD::AND, dl, MVT::i32, NarrowOp, ConstOp); - return DAG.getAnyExtOrTrunc(NarrowAnd, dl, N->getValueType(0)); + return DAG.getZExtOrTrunc(NarrowAnd, dl, N->getValueType(0)); } case ISD::SHL: return combineSHL(N, DCI); diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp index d9750ea22e2b..0f1cb5f1e236 100644 --- a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -48539,13 +48539,28 @@ static SDValue combineSetCCMOVMSK(SDValue EFLAGS, X86::CondCode &CC, } // MOVMSK(SHUFFLE(X,u)) -> MOVMSK(X) iff every element is referenced. - SmallVector ShuffleMask; + // Since we peek through a bitcast, we need to be careful if the base vector + // type has smaller elements than the MOVMSK type. In that case, even if + // all the elements are demanded by the shuffle mask, only the "high" + // elements which have highbits that align with highbits in the MOVMSK vec + // elements are actually demanded. A simplification of spurious operations + // on the "low" elements take place during other simplifications. + // + // For example: + // MOVMSK64(BITCAST(SHUF32 X, (1,0,3,2))) even though all the elements are + // demanded, because we are swapping around the result can change. + // + // To address this, we check that we can scale the shuffle mask to MOVMSK + // element width (this will ensure "high" elements match). Its slightly overly + // conservative, but fine for an edge case fold. + SmallVector ShuffleMask, ScaledMaskUnused; SmallVector ShuffleInputs; if (NumElts <= CmpBits && getTargetShuffleInputs(peekThroughBitcasts(Vec), ShuffleInputs, ShuffleMask, DAG) && ShuffleInputs.size() == 1 && !isAnyZeroOrUndef(ShuffleMask) && - ShuffleInputs[0].getValueSizeInBits() == VecVT.getSizeInBits()) { + ShuffleInputs[0].getValueSizeInBits() == VecVT.getSizeInBits() && + scaleShuffleElements(ShuffleMask, NumElts, ScaledMaskUnused)) { unsigned NumShuffleElts = ShuffleMask.size(); APInt DemandedElts = APInt::getZero(NumShuffleElts); for (int M : ShuffleMask) { @@ -57239,7 +57254,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT, // TODO - combineX86ShufflesRecursively should handle shuffle concatenation // but it currently struggles with different vector widths. if (llvm::all_of(Ops, [Op0](SDValue Op) { - return Op.getOpcode() == Op0.getOpcode(); + return Op.getOpcode() == Op0.getOpcode() && Op.hasOneUse(); })) { auto ConcatSubOperand = [&](EVT VT, ArrayRef SubOps, unsigned I) { SmallVector Subs; diff --git a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index bde5fba20f3b..f4bf6db569f2 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -819,11 +819,11 @@ public: private: void initializeCallbacks(Module &M); - bool InstrumentGlobals(IRBuilder<> &IRB, Module &M, bool *CtorComdat); + void instrumentGlobals(IRBuilder<> &IRB, Module &M, bool *CtorComdat); void InstrumentGlobalsCOFF(IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, ArrayRef MetadataInitializers); - void InstrumentGlobalsELF(IRBuilder<> &IRB, Module &M, + void instrumentGlobalsELF(IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, ArrayRef MetadataInitializers, const std::string &UniqueModuleId); @@ -2177,7 +2177,7 @@ void ModuleAddressSanitizer::InstrumentGlobalsCOFF( appendToCompilerUsed(M, MetadataGlobals); } -void ModuleAddressSanitizer::InstrumentGlobalsELF( +void ModuleAddressSanitizer::instrumentGlobalsELF( IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, ArrayRef MetadataInitializers, const std::string &UniqueModuleId) { @@ -2187,7 +2187,7 @@ void ModuleAddressSanitizer::InstrumentGlobalsELF( // false negative odr violations at link time. If odr indicators are used, we // keep the comdat sections, as link time odr violations will be dectected on // the odr indicator symbols. - bool UseComdatForGlobalsGC = UseOdrIndicator; + bool UseComdatForGlobalsGC = UseOdrIndicator && !UniqueModuleId.empty(); SmallVector MetadataGlobals(ExtendedGlobals.size()); for (size_t i = 0; i < ExtendedGlobals.size(); i++) { @@ -2237,7 +2237,7 @@ void ModuleAddressSanitizer::InstrumentGlobalsELF( // We also need to unregister globals at the end, e.g., when a shared library // gets closed. - if (DestructorKind != AsanDtorKind::None) { + if (DestructorKind != AsanDtorKind::None && !MetadataGlobals.empty()) { IRBuilder<> IrbDtor(CreateAsanModuleDtor(M)); IrbDtor.CreateCall(AsanUnregisterElfGlobals, {IRB.CreatePointerCast(RegisteredFlag, IntptrTy), @@ -2343,10 +2343,8 @@ void ModuleAddressSanitizer::InstrumentGlobalsWithMetadataArray( // redzones and inserts this function into llvm.global_ctors. // Sets *CtorComdat to true if the global registration code emitted into the // asan constructor is comdat-compatible. -bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M, +void ModuleAddressSanitizer::instrumentGlobals(IRBuilder<> &IRB, Module &M, bool *CtorComdat) { - *CtorComdat = false; - // Build set of globals that are aliased by some GA, where // getExcludedAliasedGlobal(GA) returns the relevant GlobalVariable. SmallPtrSet AliasedGlobalExclusions; @@ -2364,11 +2362,6 @@ bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M, } size_t n = GlobalsToChange.size(); - if (n == 0) { - *CtorComdat = true; - return false; - } - auto &DL = M.getDataLayout(); // A global is described by a structure @@ -2391,8 +2384,11 @@ bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M, // We shouldn't merge same module names, as this string serves as unique // module ID in runtime. - GlobalVariable *ModuleName = createPrivateGlobalForString( - M, M.getModuleIdentifier(), /*AllowMerging*/ false, kAsanGenPrefix); + GlobalVariable *ModuleName = + n != 0 + ? createPrivateGlobalForString(M, M.getModuleIdentifier(), + /*AllowMerging*/ false, kAsanGenPrefix) + : nullptr; for (size_t i = 0; i < n; i++) { GlobalVariable *G = GlobalsToChange[i]; @@ -2517,19 +2513,27 @@ bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M, } appendToCompilerUsed(M, ArrayRef(GlobalsToAddToUsedList)); - std::string ELFUniqueModuleId = - (UseGlobalsGC && TargetTriple.isOSBinFormatELF()) ? getUniqueModuleId(&M) - : ""; - - if (!ELFUniqueModuleId.empty()) { - InstrumentGlobalsELF(IRB, M, NewGlobals, Initializers, ELFUniqueModuleId); + if (UseGlobalsGC && TargetTriple.isOSBinFormatELF()) { + // Use COMDAT and register globals even if n == 0 to ensure that (a) the + // linkage unit will only have one module constructor, and (b) the register + // function will be called. The module destructor is not created when n == + // 0. *CtorComdat = true; - } else if (UseGlobalsGC && TargetTriple.isOSBinFormatCOFF()) { - InstrumentGlobalsCOFF(IRB, M, NewGlobals, Initializers); - } else if (UseGlobalsGC && ShouldUseMachOGlobalsSection()) { - InstrumentGlobalsMachO(IRB, M, NewGlobals, Initializers); + instrumentGlobalsELF(IRB, M, NewGlobals, Initializers, + getUniqueModuleId(&M)); + } else if (n == 0) { + // When UseGlobalsGC is false, COMDAT can still be used if n == 0, because + // all compile units will have identical module constructor/destructor. + *CtorComdat = TargetTriple.isOSBinFormatELF(); } else { - InstrumentGlobalsWithMetadataArray(IRB, M, NewGlobals, Initializers); + *CtorComdat = false; + if (UseGlobalsGC && TargetTriple.isOSBinFormatCOFF()) { + InstrumentGlobalsCOFF(IRB, M, NewGlobals, Initializers); + } else if (UseGlobalsGC && ShouldUseMachOGlobalsSection()) { + InstrumentGlobalsMachO(IRB, M, NewGlobals, Initializers); + } else { + InstrumentGlobalsWithMetadataArray(IRB, M, NewGlobals, Initializers); + } } // Create calls for poisoning before initializers run and unpoisoning after. @@ -2537,7 +2541,6 @@ bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M, createInitializerPoisonCalls(M, ModuleName); LLVM_DEBUG(dbgs() << M); - return true; } uint64_t @@ -2601,10 +2604,10 @@ bool ModuleAddressSanitizer::instrumentModule(Module &M) { assert(AsanCtorFunction || ConstructorKind == AsanCtorKind::None); if (AsanCtorFunction) { IRBuilder<> IRB(AsanCtorFunction->getEntryBlock().getTerminator()); - InstrumentGlobals(IRB, M, &CtorComdat); + instrumentGlobals(IRB, M, &CtorComdat); } else { IRBuilder<> IRB(*C); - InstrumentGlobals(IRB, M, &CtorComdat); + instrumentGlobals(IRB, M, &CtorComdat); } } diff --git a/lib/clang/include/VCSVersion.inc b/lib/clang/include/VCSVersion.inc index 09e5bd0806a8..7f43e4566eeb 100644 --- a/lib/clang/include/VCSVersion.inc +++ b/lib/clang/include/VCSVersion.inc @@ -1,8 +1,8 @@ -#define LLVM_REVISION "llvmorg-17.0.2-0-gb2417f51dbbd" +#define LLVM_REVISION "llvmorg-17.0.3-0-g888437e1b600" #define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git" -#define CLANG_REVISION "llvmorg-17.0.2-0-gb2417f51dbbd" +#define CLANG_REVISION "llvmorg-17.0.3-0-g888437e1b600" #define CLANG_REPOSITORY "https://github.com/llvm/llvm-project.git" -#define LLDB_REVISION "llvmorg-17.0.2-0-gb2417f51dbbd" +#define LLDB_REVISION "llvmorg-17.0.3-0-g888437e1b600" #define LLDB_REPOSITORY "https://github.com/llvm/llvm-project.git" diff --git a/lib/clang/include/clang/Basic/Version.inc b/lib/clang/include/clang/Basic/Version.inc index 750d9ecbc020..c364a69c7209 100644 --- a/lib/clang/include/clang/Basic/Version.inc +++ b/lib/clang/include/clang/Basic/Version.inc @@ -1,8 +1,8 @@ -#define CLANG_VERSION 17.0.2 -#define CLANG_VERSION_STRING "17.0.2" +#define CLANG_VERSION 17.0.3 +#define CLANG_VERSION_STRING "17.0.3" #define CLANG_VERSION_MAJOR 17 #define CLANG_VERSION_MAJOR_STRING "17" #define CLANG_VERSION_MINOR 0 -#define CLANG_VERSION_PATCHLEVEL 2 +#define CLANG_VERSION_PATCHLEVEL 3 #define CLANG_VENDOR "FreeBSD " diff --git a/lib/clang/include/lld/Common/Version.inc b/lib/clang/include/lld/Common/Version.inc index 722673ac78da..b650ccd7fc2b 100644 --- a/lib/clang/include/lld/Common/Version.inc +++ b/lib/clang/include/lld/Common/Version.inc @@ -1,4 +1,4 @@ // Local identifier in __FreeBSD_version style #define LLD_FREEBSD_VERSION 1400006 -#define LLD_VERSION_STRING "17.0.2 (FreeBSD llvmorg-17.0.2-0-gb2417f51dbbd-" __XSTRING(LLD_FREEBSD_VERSION) ")" +#define LLD_VERSION_STRING "17.0.3 (FreeBSD llvmorg-17.0.3-0-g888437e1b600-" __XSTRING(LLD_FREEBSD_VERSION) ")" diff --git a/lib/clang/include/lldb/Version/Version.inc b/lib/clang/include/lldb/Version/Version.inc index b87053e1884d..e9dbb0ca765e 100644 --- a/lib/clang/include/lldb/Version/Version.inc +++ b/lib/clang/include/lldb/Version/Version.inc @@ -1,6 +1,6 @@ -#define LLDB_VERSION 17.0.2 -#define LLDB_VERSION_STRING "17.0.2" +#define LLDB_VERSION 17.0.3 +#define LLDB_VERSION_STRING "17.0.3" #define LLDB_VERSION_MAJOR 17 #define LLDB_VERSION_MINOR 0 -#define LLDB_VERSION_PATCH 2 +#define LLDB_VERSION_PATCH 3 /* #undef LLDB_FULL_VERSION_STRING */ diff --git a/lib/clang/include/llvm/Config/config.h b/lib/clang/include/llvm/Config/config.h index 56b377d33f9b..652cc426aa3c 100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@ -344,10 +344,10 @@ #define PACKAGE_NAME "LLVM" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "LLVM 17.0.2" +#define PACKAGE_STRING "LLVM 17.0.3" /* Define to the version of this package. */ -#define PACKAGE_VERSION "17.0.2" +#define PACKAGE_VERSION "17.0.3" /* Define to the vendor of this package. */ /* #undef PACKAGE_VENDOR */ diff --git a/lib/clang/include/llvm/Config/llvm-config.h b/lib/clang/include/llvm/Config/llvm-config.h index 36bf884d2fdb..6d3ed70bb0fd 100644 --- a/lib/clang/include/llvm/Config/llvm-config.h +++ b/lib/clang/include/llvm/Config/llvm-config.h @@ -73,10 +73,10 @@ #define LLVM_VERSION_MINOR 0 /* Patch version of the LLVM API */ -#define LLVM_VERSION_PATCH 2 +#define LLVM_VERSION_PATCH 3 /* LLVM version string */ -#define LLVM_VERSION_STRING "17.0.2" +#define LLVM_VERSION_STRING "17.0.3" /* Whether LLVM records statistics for use with GetStatistics(), * PrintStatistics() or PrintStatisticsJSON() diff --git a/lib/clang/include/llvm/Support/VCSRevision.h b/lib/clang/include/llvm/Support/VCSRevision.h index 846d3cb3e014..bca8b103a7ba 100644 --- a/lib/clang/include/llvm/Support/VCSRevision.h +++ b/lib/clang/include/llvm/Support/VCSRevision.h @@ -1,2 +1,2 @@ -#define LLVM_REVISION "llvmorg-17.0.2-0-gb2417f51dbbd" +#define LLVM_REVISION "llvmorg-17.0.3-0-g888437e1b600" #define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git"