From 791701a7dc6225242c41502cb3ed6874623c1785 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 22 May 2023 18:21:37 +0200 Subject: [PATCH] Vendor import of llvm-project branch release/16.x llvmorg-16.0.4-0-gae42196bc493 (aka 16.0.4 release). --- clang/lib/AST/TypePrinter.cpp | 2 +- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- clang/lib/Driver/ToolChains/MSVC.cpp | 2 +- clang/lib/Sema/SemaInit.cpp | 16 +++++++++------- libcxx/include/__config | 2 +- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 9 +++------ llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 6 ++++-- llvm/lib/Target/X86/X86FrameLowering.cpp | 14 +++++++++++++- 8 files changed, 33 insertions(+), 20 deletions(-) diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index 5c246490448..2d06faeca18 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -1812,7 +1812,7 @@ void TypePrinter::printAttributedAfter(const AttributedType *T, void TypePrinter::printBTFTagAttributedBefore(const BTFTagAttributedType *T, raw_ostream &OS) { printBefore(T->getWrappedType(), OS); - OS << " btf_type_tag(" << T->getAttr()->getBTFTypeTag() << ")"; + OS << " __attribute__((btf_type_tag(\"" << T->getAttr()->getBTFTypeTag() << "\")))"; } void TypePrinter::printBTFTagAttributedAfter(const BTFTagAttributedType *T, diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index ec6860113b7..238507e0633 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -7782,7 +7782,7 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, if (Args.hasArg(options::OPT__SLASH_kernel)) CmdArgs.push_back("-fms-kernel"); - if (Arg *A = Args.getLastArg(options::OPT__SLASH_guard)) { + for (const Arg *A : Args.filtered(options::OPT__SLASH_guard)) { StringRef GuardArgs = A->getValue(); // The only valid options are "cf", "cf,nochecks", "cf-", "ehcont" and // "ehcont-". diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp index 8ad67ca3e13..b8aa21b7a76 100644 --- a/clang/lib/Driver/ToolChains/MSVC.cpp +++ b/clang/lib/Driver/ToolChains/MSVC.cpp @@ -227,7 +227,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA, Args.AddAllArgValues(CmdArgs, options::OPT__SLASH_link); // Control Flow Guard checks - if (Arg *A = Args.getLastArg(options::OPT__SLASH_guard)) { + for (const Arg *A : Args.filtered(options::OPT__SLASH_guard)) { StringRef GuardArgs = A->getValue(); if (GuardArgs.equals_insensitive("cf") || GuardArgs.equals_insensitive("cf,nochecks")) { diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 99801a88e3e..44adb167dcc 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -5348,14 +5348,16 @@ static void TryOrBuildParenListInitialization( // The remaining elements are initialized with their default member // initializers, if any auto *FD = cast(SubEntity.getDecl()); - if (Expr *ICE = FD->getInClassInitializer(); ICE && !VerifyOnly) { - ExprResult DIE = S.BuildCXXDefaultInitExpr(FD->getLocation(), FD); - if (DIE.isInvalid()) - return false; - S.checkInitializerLifetime(SubEntity, DIE.get()); - InitExprs.push_back(DIE.get()); + if (FD->hasInClassInitializer()) { + if (!VerifyOnly) { + ExprResult DIE = S.BuildCXXDefaultInitExpr(FD->getLocation(), FD); + if (DIE.isInvalid()) + return false; + S.checkInitializerLifetime(SubEntity, DIE.get()); + InitExprs.push_back(DIE.get()); + } continue; - }; + } } // Remaining class elements without default member initializers and // array elements are value initialized: diff --git a/libcxx/include/__config b/libcxx/include/__config index 36bdbd8680d..9009b9014ab 100644 --- a/libcxx/include/__config +++ b/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 160003 +# define _LIBCPP_VERSION 160004 # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 8d4c8802f71..3de4efb5ba2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1724,12 +1724,9 @@ bool TargetLowering::SimplifyDemandedBits( unsigned InnerBits = InnerVT.getScalarSizeInBits(); if (ShAmt < InnerBits && DemandedBits.getActiveBits() <= InnerBits && isTypeDesirableForOp(ISD::SHL, InnerVT)) { - EVT ShTy = getShiftAmountTy(InnerVT, DL); - if (!APInt(BitWidth, ShAmt).isIntN(ShTy.getSizeInBits())) - ShTy = InnerVT; - SDValue NarrowShl = - TLO.DAG.getNode(ISD::SHL, dl, InnerVT, InnerOp, - TLO.DAG.getConstant(ShAmt, dl, ShTy)); + SDValue NarrowShl = TLO.DAG.getNode( + ISD::SHL, dl, InnerVT, InnerOp, + TLO.DAG.getShiftAmountConstant(ShAmt, InnerVT, dl)); return TLO.CombineTo( Op, TLO.DAG.getNode(ISD::ANY_EXTEND, dl, VT, NarrowShl)); } diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp index 5dca792dc89..0b3059df124 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -8488,11 +8488,13 @@ SystemZTargetLowering::emitMemMemWrapper(MachineInstr &MI, .addReg(RemSrcReg).addImm(SrcDisp); MBB->addSuccessor(AllDoneMBB); MBB = AllDoneMBB; - if (EndMBB) { + if (Opcode != SystemZ::MVC) { EXRL_MIB.addReg(SystemZ::CC, RegState::ImplicitDefine); - MBB->addLiveIn(SystemZ::CC); + if (EndMBB) + MBB->addLiveIn(SystemZ::CC); } } + MF.getProperties().reset(MachineFunctionProperties::Property::NoPHIs); } // Handle any remaining bytes with straight-line code. diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index 1606413c382..df9aaddd572 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -1557,7 +1557,19 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF, Fn.arg_size() == 2) { StackSize += 8; MFI.setStackSize(StackSize); - emitSPUpdate(MBB, MBBI, DL, -8, /*InEpilogue=*/false); + + // Update the stack pointer by pushing a register. This is the instruction + // emitted that would be end up being emitted by a call to `emitSPUpdate`. + // Hard-coding the update to a push avoids emitting a second + // `STACKALLOC_W_PROBING` instruction in the save block: We know that stack + // probing isn't needed anyways for an 8-byte update. + // Pushing a register leaves us in a similar situation to a regular + // function call where we know that the address at (rsp-8) is writeable. + // That way we avoid any off-by-ones with stack probing for additional + // stack pointer updates later on. + BuildMI(MBB, MBBI, DL, TII.get(X86::PUSH64r)) + .addReg(X86::RAX, RegState::Undef) + .setMIFlag(MachineInstr::FrameSetup); } // If this is x86-64 and the Red Zone is not disabled, if we are a leaf