diff --git a/contrib/llvm-project/clang/lib/AST/Expr.cpp b/contrib/llvm-project/clang/lib/AST/Expr.cpp index 67862a8692ac..e45ae68cd5fe 100644 --- a/contrib/llvm-project/clang/lib/AST/Expr.cpp +++ b/contrib/llvm-project/clang/lib/AST/Expr.cpp @@ -1963,6 +1963,10 @@ Expr *ignoreImplicitSemaNodes(Expr *E) { if (auto *Full = dyn_cast(E)) return Full->getSubExpr(); + if (auto *CPLIE = dyn_cast(E); + CPLIE && CPLIE->getInitExprs().size() == 1) + return CPLIE->getInitExprs()[0]; + return E; } } // namespace diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp index 0883631dfe98..34640b3c450d 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -757,6 +757,13 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, D.Diag(clang::diag::warn_drv_fjmc_for_elf_only); } + if (Arg *A = Args.getLastArg(options::OPT_femulated_tls, + options::OPT_fno_emulated_tls)) { + bool Enable = A->getOption().getID() == options::OPT_femulated_tls; + CmdArgs.push_back(Args.MakeArgString( + Twine(PluginOptPrefix) + "-emulated-tls=" + (Enable ? "1" : "0"))); + } + if (Args.hasFlag(options::OPT_fstack_size_section, options::OPT_fno_stack_size_section, false)) CmdArgs.push_back( diff --git a/contrib/llvm-project/clang/lib/Sema/SemaInit.cpp b/contrib/llvm-project/clang/lib/Sema/SemaInit.cpp index ddb2b5cf5cd1..99801a88e3ed 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaInit.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaInit.cpp @@ -5420,8 +5420,9 @@ static void TryOrBuildParenListInitialization( } else if (auto *RT = Entity.getType()->getAs()) { const CXXRecordDecl *RD = cast(RT->getDecl()); - auto BaseRange = map_range(RD->bases(), [&S](auto &base) { - return InitializedEntity::InitializeBase(S.getASTContext(), &base, false); + auto BaseRange = map_range(RD->bases(), [&](auto &base) { + return InitializedEntity::InitializeBase(S.getASTContext(), &base, false, + &Entity); }); auto FieldRange = map_range(RD->fields(), [](auto *field) { return InitializedEntity::InitializeMember(field); @@ -9180,6 +9181,8 @@ ExprResult InitializationSequence::Perform(Sema &S, /*VerifyOnly=*/false, &CurInit); if (CurInit.get() && ResultType) *ResultType = CurInit.get()->getType(); + if (shouldBindAsTemporary(Entity)) + CurInit = S.MaybeBindToTemporary(CurInit.get()); break; } } diff --git a/contrib/llvm-project/clang/lib/Sema/TreeTransform.h b/contrib/llvm-project/clang/lib/Sema/TreeTransform.h index 48bb28b56cd3..4244bbc1e4b1 100644 --- a/contrib/llvm-project/clang/lib/Sema/TreeTransform.h +++ b/contrib/llvm-project/clang/lib/Sema/TreeTransform.h @@ -3137,6 +3137,13 @@ class TreeTransform { Expr *Sub, SourceLocation RParenLoc, bool ListInitialization) { + // If Sub is a ParenListExpr, then Sub is the syntatic form of a + // CXXParenListInitExpr. Pass its expanded arguments so that the + // CXXParenListInitExpr can be rebuilt. + if (auto *PLE = dyn_cast(Sub)) + return getSema().BuildCXXTypeConstructExpr( + TInfo, LParenLoc, MultiExprArg(PLE->getExprs(), PLE->getNumExprs()), + RParenLoc, ListInitialization); return getSema().BuildCXXTypeConstructExpr(TInfo, LParenLoc, MultiExprArg(&Sub, 1), RParenLoc, ListInitialization); @@ -3866,16 +3873,6 @@ class TreeTransform { return getSema().BuildEmptyCXXFoldExpr(EllipsisLoc, Operator); } - ExprResult RebuildCXXParenListInitExpr(ArrayRef Args, QualType T, - unsigned NumUserSpecifiedExprs, - SourceLocation InitLoc, - SourceLocation LParenLoc, - SourceLocation RParenLoc) { - return CXXParenListInitExpr::Create(getSema().Context, Args, T, - NumUserSpecifiedExprs, InitLoc, - LParenLoc, RParenLoc); - } - /// Build a new atomic operation expression. /// /// By default, performs semantic analysis to build the new expression. @@ -14075,9 +14072,8 @@ TreeTransform::TransformCXXParenListInitExpr(CXXParenListInitExpr *E) { TransformedInits)) return ExprError(); - return getDerived().RebuildCXXParenListInitExpr( - TransformedInits, E->getType(), E->getUserSpecifiedInitExprs().size(), - E->getInitLoc(), E->getBeginLoc(), E->getEndLoc()); + return getDerived().RebuildParenListExpr(E->getBeginLoc(), TransformedInits, + E->getEndLoc()); } template diff --git a/contrib/llvm-project/libcxx/include/__config b/contrib/llvm-project/libcxx/include/__config index 5e30a42174af..36bdbd8680db 100644 --- a/contrib/llvm-project/libcxx/include/__config +++ b/contrib/llvm-project/libcxx/include/__config @@ -38,7 +38,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 16.0.1 == 16.00.01), _LIBCPP_VERSION is // defined to XXYYZZ. -# define _LIBCPP_VERSION 160002 +# define _LIBCPP_VERSION 160003 # 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/Driver.cpp b/contrib/llvm-project/lld/COFF/Driver.cpp index 0a153c8f6cb7..d6b71eaf7f28 100644 --- a/contrib/llvm-project/lld/COFF/Driver.cpp +++ b/contrib/llvm-project/lld/COFF/Driver.cpp @@ -436,9 +436,12 @@ void LinkerDriver::parseDirectives(InputFile *file) { case OPT_editandcontinue: case OPT_guardsym: case OPT_throwingnew: + case OPT_inferasanlibs: + case OPT_inferasanlibs_no: break; default: - error(arg->getSpelling() + " is not allowed in .drectve"); + error(arg->getSpelling() + " is not allowed in .drectve (" + + toString(file) + ")"); } } } @@ -1923,6 +1926,9 @@ void LinkerDriver::linkerMain(ArrayRef argsArr) { args.hasFlag(OPT_stdcall_fixup, OPT_stdcall_fixup_no, config->mingw); config->warnStdcallFixup = !args.hasArg(OPT_stdcall_fixup); + if (args.hasFlag(OPT_inferasanlibs, OPT_inferasanlibs_no, false)) + warn("ignoring '/inferasanlibs', this flag is not supported"); + // Don't warn about long section names, such as .debug_info, for mingw or // when -debug:dwarf is requested. if (config->mingw || config->debugDwarf) diff --git a/contrib/llvm-project/lld/COFF/Options.td b/contrib/llvm-project/lld/COFF/Options.td index df527bb48ae7..2a89509be5fe 100644 --- a/contrib/llvm-project/lld/COFF/Options.td +++ b/contrib/llvm-project/lld/COFF/Options.td @@ -194,6 +194,9 @@ defm highentropyva : B<"highentropyva", defm incremental : B<"incremental", "Keep original import library if contents are unchanged", "Overwrite import library even if contents are unchanged">; +defm inferasanlibs : B<"inferasanlibs", + "Unused, generates a warning", + "No effect (default)">; defm integritycheck : B<"integritycheck", "Set FORCE_INTEGRITY bit in PE header", "No effect (default)">; diff --git a/contrib/llvm-project/lldb/source/Host/posix/MainLoopPosix.cpp b/contrib/llvm-project/lldb/source/Host/posix/MainLoopPosix.cpp index b185c3d3b707..5b50b450433e 100644 --- a/contrib/llvm-project/lldb/source/Host/posix/MainLoopPosix.cpp +++ b/contrib/llvm-project/lldb/source/Host/posix/MainLoopPosix.cpp @@ -156,9 +156,12 @@ Status MainLoopPosix::RunImpl::Poll() { size_t sigset_len; } extra_data = {&kernel_sigset, sizeof(kernel_sigset)}; if (syscall(__NR_pselect6, nfds, &read_fd_set, nullptr, nullptr, nullptr, - &extra_data) == -1 && - errno != EINTR) - return Status(errno, eErrorTypePOSIX); + &extra_data) == -1) { + if (errno != EINTR) + return Status(errno, eErrorTypePOSIX); + else + FD_ZERO(&read_fd_set); + } return Status(); } diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp index c400ce190b46..bb33b843e024 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp @@ -175,7 +175,8 @@ bool MachineLateInstrsCleanup::processBlock(MachineBasicBlock *MBB) { Reg2DefMap &MBBDefs = RegDefs[MBB->getNumber()]; // Find reusable definitions in the predecessor(s). - if (!MBB->pred_empty() && !MBB->isEHPad()) { + if (!MBB->pred_empty() && !MBB->isEHPad() && + !MBB->isInlineAsmBrIndirectTarget()) { MachineBasicBlock *FirstPred = *MBB->pred_begin(); for (auto [Reg, DefMI] : RegDefs[FirstPred->getNumber()]) if (llvm::all_of( diff --git a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 97f129e200de..dd1e8da2eb48 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -1121,7 +1121,7 @@ static const unsigned MaxDepth = 6; // actual instructions, otherwise return a non-null dummy value. Return nullptr // on failure. static Value *takeLog2(IRBuilderBase &Builder, Value *Op, unsigned Depth, - bool DoFold) { + bool AssumeNonZero, bool DoFold) { auto IfFold = [DoFold](function_ref Fn) { if (!DoFold) return reinterpret_cast(-1); @@ -1147,14 +1147,18 @@ static Value *takeLog2(IRBuilderBase &Builder, Value *Op, unsigned Depth, // FIXME: Require one use? Value *X, *Y; if (match(Op, m_ZExt(m_Value(X)))) - if (Value *LogX = takeLog2(Builder, X, Depth, DoFold)) + if (Value *LogX = takeLog2(Builder, X, Depth, AssumeNonZero, DoFold)) return IfFold([&]() { return Builder.CreateZExt(LogX, Op->getType()); }); // log2(X << Y) -> log2(X) + Y // FIXME: Require one use unless X is 1? - if (match(Op, m_Shl(m_Value(X), m_Value(Y)))) - if (Value *LogX = takeLog2(Builder, X, Depth, DoFold)) - return IfFold([&]() { return Builder.CreateAdd(LogX, Y); }); + if (match(Op, m_Shl(m_Value(X), m_Value(Y)))) { + auto *BO = cast(Op); + // nuw will be set if the `shl` is trivially non-zero. + if (AssumeNonZero || BO->hasNoUnsignedWrap() || BO->hasNoSignedWrap()) + if (Value *LogX = takeLog2(Builder, X, Depth, AssumeNonZero, DoFold)) + return IfFold([&]() { return Builder.CreateAdd(LogX, Y); }); + } // log2(Cond ? X : Y) -> Cond ? log2(X) : log2(Y) // FIXME: missed optimization: if one of the hands of select is/contains @@ -1162,8 +1166,10 @@ static Value *takeLog2(IRBuilderBase &Builder, Value *Op, unsigned Depth, // FIXME: can both hands contain undef? // FIXME: Require one use? if (SelectInst *SI = dyn_cast(Op)) - if (Value *LogX = takeLog2(Builder, SI->getOperand(1), Depth, DoFold)) - if (Value *LogY = takeLog2(Builder, SI->getOperand(2), Depth, DoFold)) + if (Value *LogX = takeLog2(Builder, SI->getOperand(1), Depth, + AssumeNonZero, DoFold)) + if (Value *LogY = takeLog2(Builder, SI->getOperand(2), Depth, + AssumeNonZero, DoFold)) return IfFold([&]() { return Builder.CreateSelect(SI->getOperand(0), LogX, LogY); }); @@ -1171,13 +1177,18 @@ static Value *takeLog2(IRBuilderBase &Builder, Value *Op, unsigned Depth, // log2(umin(X, Y)) -> umin(log2(X), log2(Y)) // log2(umax(X, Y)) -> umax(log2(X), log2(Y)) auto *MinMax = dyn_cast(Op); - if (MinMax && MinMax->hasOneUse() && !MinMax->isSigned()) - if (Value *LogX = takeLog2(Builder, MinMax->getLHS(), Depth, DoFold)) - if (Value *LogY = takeLog2(Builder, MinMax->getRHS(), Depth, DoFold)) + if (MinMax && MinMax->hasOneUse() && !MinMax->isSigned()) { + // Use AssumeNonZero as false here. Otherwise we can hit case where + // log2(umax(X, Y)) != umax(log2(X), log2(Y)) (because overflow). + if (Value *LogX = takeLog2(Builder, MinMax->getLHS(), Depth, + /*AssumeNonZero*/ false, DoFold)) + if (Value *LogY = takeLog2(Builder, MinMax->getRHS(), Depth, + /*AssumeNonZero*/ false, DoFold)) return IfFold([&]() { - return Builder.CreateBinaryIntrinsic( - MinMax->getIntrinsicID(), LogX, LogY); + return Builder.CreateBinaryIntrinsic(MinMax->getIntrinsicID(), LogX, + LogY); }); + } return nullptr; } @@ -1297,8 +1308,10 @@ Instruction *InstCombinerImpl::visitUDiv(BinaryOperator &I) { } // Op1 udiv Op2 -> Op1 lshr log2(Op2), if log2() folds away. - if (takeLog2(Builder, Op1, /*Depth*/0, /*DoFold*/false)) { - Value *Res = takeLog2(Builder, Op1, /*Depth*/0, /*DoFold*/true); + if (takeLog2(Builder, Op1, /*Depth*/ 0, /*AssumeNonZero*/ true, + /*DoFold*/ false)) { + Value *Res = takeLog2(Builder, Op1, /*Depth*/ 0, + /*AssumeNonZero*/ true, /*DoFold*/ true); return replaceInstUsesWith( I, Builder.CreateLShr(Op0, Res, I.getName(), I.isExact())); } diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 9e0483966d3e..f662e126e378 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2455,9 +2455,13 @@ bool CompatibleSets::shouldBelongToSameSet(ArrayRef Invokes) { // Can we theoretically form the data operands for the merged `invoke`? auto IsIllegalToMergeArguments = [](auto Ops) { - Type *Ty = std::get<0>(Ops)->getType(); - assert(Ty == std::get<1>(Ops)->getType() && "Incompatible types?"); - return Ty->isTokenTy() && std::get<0>(Ops) != std::get<1>(Ops); + Use &U0 = std::get<0>(Ops); + Use &U1 = std::get<1>(Ops); + if (U0 == U1) + return false; + return U0->getType()->isTokenTy() || + !canReplaceOperandWithVariable(cast(U0.getUser()), + U0.getOperandNo()); }; assert(Invokes.size() == 2 && "Always called with exactly two candidates."); if (any_of(zip(Invokes[0]->data_ops(), Invokes[1]->data_ops()), diff --git a/lib/clang/include/VCSVersion.inc b/lib/clang/include/VCSVersion.inc index 420881e41de4..466b5ce7ecfd 100644 --- a/lib/clang/include/VCSVersion.inc +++ b/lib/clang/include/VCSVersion.inc @@ -1,10 +1,10 @@ // $FreeBSD$ -#define LLVM_REVISION "llvmorg-16.0.2-0-g18ddebe1a1a9" +#define LLVM_REVISION "llvmorg-16.0.3-0-gda3cd333bea5" #define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git" -#define CLANG_REVISION "llvmorg-16.0.2-0-g18ddebe1a1a9" +#define CLANG_REVISION "llvmorg-16.0.3-0-gda3cd333bea5" #define CLANG_REPOSITORY "https://github.com/llvm/llvm-project.git" -#define LLDB_REVISION "llvmorg-16.0.2-0-g18ddebe1a1a9" +#define LLDB_REVISION "llvmorg-16.0.3-0-gda3cd333bea5" #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 c6154e17ec22..13d7baf64730 100644 --- a/lib/clang/include/clang/Basic/Version.inc +++ b/lib/clang/include/clang/Basic/Version.inc @@ -1,10 +1,10 @@ /* $FreeBSD$ */ -#define CLANG_VERSION 16.0.2 -#define CLANG_VERSION_STRING "16.0.2" +#define CLANG_VERSION 16.0.3 +#define CLANG_VERSION_STRING "16.0.3" #define CLANG_VERSION_MAJOR 16 #define CLANG_VERSION_MAJOR_STRING "16" #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 4e2cc44c9364..8f4dd4a4b559 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 "16.0.2 (FreeBSD llvmorg-16.0.2-0-g18ddebe1a1a9-" __XSTRING(LLD_FREEBSD_VERSION) ")" +#define LLD_VERSION_STRING "16.0.3 (FreeBSD llvmorg-16.0.3-0-gda3cd333bea5-" __XSTRING(LLD_FREEBSD_VERSION) ")" diff --git a/lib/clang/include/lldb/Version/Version.inc b/lib/clang/include/lldb/Version/Version.inc index dab8cdb281fa..4434036b81e2 100644 --- a/lib/clang/include/lldb/Version/Version.inc +++ b/lib/clang/include/lldb/Version/Version.inc @@ -1,6 +1,6 @@ -#define LLDB_VERSION 16.0.2 -#define LLDB_VERSION_STRING "16.0.2" +#define LLDB_VERSION 16.0.3 +#define LLDB_VERSION_STRING "16.0.3" #define LLDB_VERSION_MAJOR 16 #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 93cb4b9dd9dc..57914743328d 100644 --- a/lib/clang/include/llvm/Config/config.h +++ b/lib/clang/include/llvm/Config/config.h @@ -348,10 +348,10 @@ #define PACKAGE_NAME "LLVM" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "LLVM 16.0.2" +#define PACKAGE_STRING "LLVM 16.0.3" /* Define to the version of this package. */ -#define PACKAGE_VERSION "16.0.2" +#define PACKAGE_VERSION "16.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 b5b415db51c4..3932cfc4d1c3 100644 --- a/lib/clang/include/llvm/Config/llvm-config.h +++ b/lib/clang/include/llvm/Config/llvm-config.h @@ -74,10 +74,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 "16.0.2" +#define LLVM_VERSION_STRING "16.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 760d4e828e07..4fa56888d33c 100644 --- a/lib/clang/include/llvm/Support/VCSRevision.h +++ b/lib/clang/include/llvm/Support/VCSRevision.h @@ -1,3 +1,3 @@ /* $FreeBSD$ */ -#define LLVM_REVISION "llvmorg-16.0.2-0-g18ddebe1a1a9" +#define LLVM_REVISION "llvmorg-16.0.3-0-gda3cd333bea5" #define LLVM_REPOSITORY "https://github.com/llvm/llvm-project.git"