git: 271697da6856 - stable/14 - Merge llvm-project release/17.x llvmorg-17.0.0-rc4-10-g0176e8729ea4

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 07 Jan 2024 17:50:23 UTC
The branch stable/14 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=271697da6856a1357b397bf795eb95a998fe7483

commit 271697da6856a1357b397bf795eb95a998fe7483
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-09-11 18:37:24 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-01-07 17:46:18 +0000

    Merge llvm-project release/17.x llvmorg-17.0.0-rc4-10-g0176e8729ea4
    
    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvmorg-17.0.0-rc4-10-g0176e8729ea4.
    
    PR:             273753
    MFC after:      1 month
    
    (cherry picked from commit 8a4dda33d67586ca2624f2a38417baa03a533a7f)
---
 .../clang/include/clang/AST/DeclBase.h             |   6 +-
 .../clang/include/clang/AST/ExprConcepts.h         |  14 +-
 .../clang/include/clang/Basic/CodeGenOptions.def   |   1 -
 .../include/clang/Basic/DiagnosticASTKinds.td      |   2 +
 .../clang/include/clang/Basic/DiagnosticGroups.td  |   1 +
 .../include/clang/Basic/DiagnosticLexKinds.td      |   4 +
 .../clang/include/clang/Basic/Sanitizers.h         |   4 +
 .../clang/include/clang/Basic/TargetInfo.h         |   4 +-
 .../clang/include/clang/Basic/riscv_vector.td      |  52 +---
 .../clang/include/clang/CodeGen/CGFunctionInfo.h   |  29 +-
 .../clang/include/clang/Driver/Options.td          |  14 +-
 .../clang/include/clang/Driver/ToolChain.h         |   2 +-
 .../llvm-project/clang/include/clang/Sema/Sema.h   |   2 -
 contrib/llvm-project/clang/lib/AST/ASTContext.cpp  |   5 +-
 .../llvm-project/clang/lib/AST/ExprConstant.cpp    |  27 +-
 .../clang/lib/Basic/Targets/LoongArch.cpp          |  21 +-
 .../clang/lib/Basic/Targets/LoongArch.h            |  13 +
 .../llvm-project/clang/lib/Basic/Targets/RISCV.cpp |   4 +-
 .../llvm-project/clang/lib/CodeGen/ABIInfoImpl.cpp |  13 +-
 .../llvm-project/clang/lib/CodeGen/ABIInfoImpl.h   |  14 +-
 .../llvm-project/clang/lib/CodeGen/BackendUtil.cpp |  23 +-
 .../llvm-project/clang/lib/CodeGen/CGCXXABI.cpp    |   3 +-
 contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp  | 244 +++++++++-------
 contrib/llvm-project/clang/lib/CodeGen/CGCall.h    |  29 ++
 contrib/llvm-project/clang/lib/CodeGen/CGClass.cpp | 106 ++++++-
 .../llvm-project/clang/lib/CodeGen/CGCoroutine.cpp |  33 +++
 .../llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp |  13 +-
 .../llvm-project/clang/lib/CodeGen/CGDebugInfo.h   |   2 +-
 contrib/llvm-project/clang/lib/CodeGen/CGDecl.cpp  |   2 +-
 .../llvm-project/clang/lib/CodeGen/CGDeclCXX.cpp   |   4 +-
 contrib/llvm-project/clang/lib/CodeGen/CGExpr.cpp  |   9 +-
 .../clang/lib/CodeGen/CGExprConstant.cpp           |   2 +-
 .../clang/lib/CodeGen/CGOpenMPRuntime.cpp          |  11 +-
 .../clang/lib/CodeGen/CodeGenABITypes.cpp          |   5 +-
 .../clang/lib/CodeGen/CodeGenFunction.cpp          |  26 +-
 .../clang/lib/CodeGen/CodeGenFunction.h            |  19 +-
 .../clang/lib/CodeGen/CodeGenModule.cpp            |  34 ++-
 .../llvm-project/clang/lib/CodeGen/CodeGenModule.h |  20 +-
 .../llvm-project/clang/lib/CodeGen/CodeGenTypes.h  |  12 +-
 .../clang/lib/CodeGen/ItaniumCXXABI.cpp            |   2 +-
 .../clang/lib/CodeGen/MicrosoftCXXABI.cpp          |   3 +-
 .../clang/lib/CodeGen/Targets/LoongArch.cpp        |  11 +-
 .../clang/lib/CodeGen/Targets/RISCV.cpp            |  24 +-
 .../llvm-project/clang/lib/CodeGen/Targets/X86.cpp |  16 +-
 contrib/llvm-project/clang/lib/Driver/Driver.cpp   |  17 +-
 .../clang/lib/Driver/SanitizerArgs.cpp             |  32 +++
 .../llvm-project/clang/lib/Driver/ToolChain.cpp    |   6 +
 .../clang/lib/Driver/ToolChains/AIX.cpp            |   6 +
 .../clang/lib/Driver/ToolChains/Arch/LoongArch.cpp |  43 +--
 .../clang/lib/Driver/ToolChains/Arch/LoongArch.h   |   6 +
 .../clang/lib/Driver/ToolChains/Arch/X86.cpp       |   6 +
 .../clang/lib/Driver/ToolChains/Clang.cpp          |  39 +--
 .../clang/lib/Driver/ToolChains/CommonArgs.cpp     |   9 +-
 .../clang/lib/Driver/ToolChains/Gnu.cpp            |  22 +-
 .../clang/lib/Driver/ToolChains/Hexagon.cpp        |   5 +
 .../clang/lib/Driver/ToolChains/Solaris.cpp        |  41 ++-
 .../clang/lib/Format/UnwrappedLineParser.cpp       |   5 +-
 .../clang/lib/Frontend/FrontendAction.cpp          |   5 +
 .../clang/lib/Headers/__clang_cuda_math.h          |   2 +-
 .../lib/Headers/__clang_hip_libdevice_declares.h   |   2 +-
 contrib/llvm-project/clang/lib/Headers/cpuid.h     |  10 -
 .../clang/lib/Interpreter/IncrementalExecutor.cpp  |  19 +-
 .../llvm-project/clang/lib/Lex/LiteralSupport.cpp  |  41 ++-
 .../llvm-project/clang/lib/Parse/ParseDeclCXX.cpp  |  19 +-
 .../clang/lib/Parse/ParseTentative.cpp             |   1 +
 .../clang/lib/Sema/SemaAvailability.cpp            |  12 +
 contrib/llvm-project/clang/lib/Sema/SemaCast.cpp   |   8 +
 contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp   |   3 +-
 contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp   |  95 +++----
 .../llvm-project/clang/lib/Sema/SemaExprCXX.cpp    |  25 +-
 contrib/llvm-project/clang/lib/Sema/SemaLookup.cpp |  68 +++--
 .../clang/lib/Sema/SemaTemplateInstantiate.cpp     |  17 +-
 .../llvm-project/clang/lib/Sema/TreeTransform.h    |   4 +
 .../clang/lib/Serialization/ASTReaderDecl.cpp      |  66 +++--
 .../clang/lib/Serialization/ASTWriterDecl.cpp      |   4 +-
 .../lib/Tooling/Inclusions/Stdlib/StdSymbolMap.inc |  54 ++++
 .../compiler-rt/lib/asan/asan_interceptors.cpp     |  56 ++--
 .../compiler-rt/lib/asan/asan_interceptors.h       |   2 -
 .../compiler-rt/lib/asan/asan_win_dll_thunk.cpp    |   2 +
 .../compiler-rt/lib/builtins/aarch64/lse.S         |  40 ++-
 .../compiler-rt/lib/builtins/clear_cache.c         |   2 +-
 .../compiler-rt/lib/builtins/cpu_model.c           |   5 +-
 .../compiler-rt/lib/interception/interception.h    |   2 +-
 .../compiler-rt/lib/msan/msan_interceptors.cpp     |  37 +++
 .../compiler-rt/lib/profile/InstrProfilingFile.c   |  10 +-
 .../sanitizer_common_interceptors.inc              |  73 +++--
 .../sanitizer_common_interceptors_format.inc       |  16 +-
 .../sanitizer_stacktrace_sparc.cpp                 |   6 -
 .../sanitizer_unwind_linux_libcdep.cpp             |   6 -
 .../symbolizer/scripts/global_symbols.txt          |   7 +
 .../libcxx/include/__algorithm/pstl_sort.h         |   1 +
 contrib/llvm-project/libcxx/include/__config       |  36 ++-
 .../libcxx/include/__format/format_functions.h     |   3 +
 .../__locale_dir/locale_base_api/locale_guard.h    |   1 +
 .../llvm-project/libcxx/include/__mdspan/extents.h |  63 +++--
 .../libcxx/include/__mdspan/layout_left.h          |  32 ++-
 .../libcxx/include/__mdspan/layout_right.h         |  30 +-
 .../llvm-project/libcxx/include/__mdspan/mdspan.h  | 308 +++++++++++++++++++++
 .../llvm-project/libcxx/include/__std_clang_module | 226 +++++++++++++++
 .../__type_traits/is_nothrow_constructible.h       |   3 +-
 contrib/llvm-project/libcxx/include/mdspan         | 130 +++++++++
 .../libcxx/include/module.modulemap.in             |  65 ++---
 contrib/llvm-project/libcxx/include/sstream        |  50 ++--
 .../llvm-project/libcxx/modules/std/atomic.cppm    |   3 -
 .../llvm-project/libcxx/modules/std/execution.cppm |   2 +-
 .../libcxx/modules/std/filesystem.cppm             |   4 +-
 .../llvm-project/libcxx/modules/std/mdspan.cppm    |   2 +-
 contrib/llvm-project/libcxx/src/chrono.cpp         |   2 +-
 .../libcxx/src/filesystem/filesystem_clock.cpp     |   2 +-
 .../llvm-project/libunwind/src/Unwind-EHABI.cpp    |   7 +-
 contrib/llvm-project/lld/ELF/Arch/LoongArch.cpp    |   7 +
 contrib/llvm-project/lld/ELF/Arch/PPC.cpp          |  12 +-
 contrib/llvm-project/lld/ELF/Arch/PPC64.cpp        |  86 ++++--
 contrib/llvm-project/lld/ELF/Target.h              |   1 +
 contrib/llvm-project/lld/docs/ReleaseNotes.rst     |   5 +
 .../ObjC/GNUstepObjCRuntime/GNUstepObjCRuntime.cpp |  42 ++-
 .../Process/Utility/RegisterContextPOSIX_arm64.cpp |   4 +
 .../Process/Utility/RegisterContextPOSIX_arm64.h   |   1 +
 .../Process/Utility/RegisterInfoPOSIX_arm64.h      |   1 +
 .../elf-core/RegisterContextPOSIXCore_arm64.cpp    |  14 +
 .../elf-core/RegisterContextPOSIXCore_arm64.h      |   1 +
 .../Plugins/Process/elf-core/RegisterUtilities.h   |   4 +
 .../llvm/include/llvm/ADT/FunctionExtras.h         |  12 +-
 .../llvm/include/llvm/ADT/SmallVector.h            |   4 +-
 .../llvm/include/llvm/Analysis/LazyValueInfo.h     |   3 +
 .../llvm/include/llvm/Analysis/RegionInfoImpl.h    |   4 +-
 .../llvm/include/llvm/Analysis/ValueTracking.h     |   4 -
 .../llvm/include/llvm/CodeGen/CodeGenPassBuilder.h |   2 +-
 .../llvm/include/llvm/CodeGen/LowLevelType.h       |   7 +-
 .../llvm/CodeGen/PreISelIntrinsicLowering.h        |   4 +
 .../llvm/include/llvm/CodeGen/TargetInstrInfo.h    |  17 --
 .../llvm-project/llvm/include/llvm/Object/Wasm.h   |  10 +-
 .../llvm/include/llvm/ObjectYAML/WasmYAML.h        |   1 +
 .../llvm/include/llvm/Option/ArgList.h             |   1 +
 .../llvm/include/llvm/Support/type_traits.h        |  38 ---
 .../llvm/TargetParser/LoongArchTargetParser.h      |   5 +-
 .../AggressiveInstCombine/AggressiveInstCombine.h  |   2 +-
 .../llvm/Transforms/IPO/FunctionSpecialization.h   |  15 +-
 .../llvm/Transforms/Scalar/MemCpyOptimizer.h       |   4 -
 .../llvm/lib/Analysis/LazyValueInfo.cpp            |   9 +
 .../llvm/lib/Analysis/ScalarEvolution.cpp          |   2 +-
 .../llvm/lib/Analysis/ValueTracking.cpp            |   7 -
 .../llvm/lib/CodeGen/CalcSpillWeights.cpp          |  15 +-
 .../llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp |  30 +-
 .../llvm/lib/CodeGen/InlineSpiller.cpp             |  34 ++-
 .../llvm/lib/CodeGen/LiveRangeEdit.cpp             |   3 +-
 .../llvm/lib/CodeGen/LiveRangeShrink.cpp           |   4 +-
 .../llvm-project/llvm/lib/CodeGen/MachineLICM.cpp  |   4 +
 .../llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp  |  54 ++--
 .../llvm/lib/CodeGen/RegAllocGreedy.cpp            |  21 +-
 .../llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp  |   6 +-
 .../llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp |   3 +
 .../CodeGen/SelectionDAG/SelectionDAGBuilder.cpp   |  99 ++++---
 contrib/llvm-project/llvm/lib/CodeGen/SplitKit.cpp |  17 +-
 contrib/llvm-project/llvm/lib/CodeGen/SplitKit.h   |   7 +-
 .../llvm/lib/CodeGen/TargetInstrInfo.cpp           |   7 +-
 .../llvm/lib/CodeGen/TargetLoweringBase.cpp        |   2 +-
 .../lib/CodeGen/TargetLoweringObjectFileImpl.cpp   |  21 +-
 contrib/llvm-project/llvm/lib/LTO/LTO.cpp          |   7 +-
 .../llvm/lib/ObjCopy/wasm/WasmObject.h             |   1 +
 .../llvm/lib/ObjCopy/wasm/WasmReader.cpp           |   4 +-
 .../llvm/lib/ObjCopy/wasm/WasmWriter.cpp           |  13 +-
 .../llvm-project/llvm/lib/Object/SymbolSize.cpp    |  17 +-
 .../llvm/lib/Object/WasmObjectFile.cpp             |   4 +
 .../llvm/lib/ObjectYAML/WasmEmitter.cpp            |  12 +-
 .../llvm-project/llvm/lib/ObjectYAML/WasmYAML.cpp  |   1 +
 contrib/llvm-project/llvm/lib/Option/ArgList.cpp   |   7 +
 .../llvm-project/llvm/lib/TableGen/TGParser.cpp    |   9 +-
 .../llvm/lib/Target/AArch64/AArch64.td             |   6 +-
 .../lib/Target/AArch64/AArch64FrameLowering.cpp    |  13 +-
 .../lib/Target/AArch64/AArch64ISelLowering.cpp     |  69 +++--
 .../llvm/lib/Target/AArch64/AArch64InstrFormats.td |   9 +-
 .../llvm/lib/Target/AArch64/AArch64InstrInfo.cpp   |  11 +-
 .../llvm/lib/Target/AArch64/AArch64InstrInfo.td    |  20 +-
 .../Target/AArch64/AArch64LoadStoreOptimizer.cpp   |   8 +-
 .../llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td |  49 ++--
 .../llvm/lib/Target/AArch64/AArch64Subtarget.h     |   2 +-
 .../Target/AArch64/GISel/AArch64CallLowering.cpp   |   5 +
 .../llvm/lib/Target/AArch64/SVEInstrFormats.td     |   7 +
 .../llvm-project/llvm/lib/Target/AMDGPU/AMDGPU.h   |   4 -
 .../llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp  |  37 ++-
 .../llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h    |   2 +-
 .../llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp |  47 +++-
 .../llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.h   |   2 +-
 .../llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp |  16 +-
 .../llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp |   4 -
 .../llvm/lib/Target/AMDGPU/SIFrameLowering.cpp     |  16 +-
 .../llvm/lib/Target/AMDGPU/SIISelLowering.cpp      |   2 +-
 .../llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp    |   7 +-
 .../llvm/lib/Target/AMDGPU/SIInstrInfo.cpp         |  45 +--
 .../llvm/lib/Target/AMDGPU/SIInstrInfo.h           |  19 +-
 .../llvm/lib/Target/AMDGPU/SIInstructions.td       |   7 -
 .../llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp   | 136 ++-------
 .../llvm/lib/Target/AMDGPU/SILowerWWMCopies.cpp    | 141 ----------
 .../lib/Target/AMDGPU/SIMachineFunctionInfo.cpp    |  69 ++---
 .../llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h |  39 ++-
 .../llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp      |  23 +-
 .../llvm/lib/Target/AMDGPU/SIRegisterInfo.h        |  17 +-
 .../llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp |   2 +
 .../Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp   |   6 +-
 .../llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp |  26 +-
 .../llvm-project/llvm/lib/Target/BPF/BTFDebug.cpp  |   2 +
 .../llvm/lib/Target/LoongArch/LoongArch.td         |   5 +
 .../lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp  |  50 +++-
 .../Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp |  14 +-
 .../llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp    |  37 +--
 .../llvm/lib/Target/PowerPC/PPCInstrFormats.td     |   6 +
 .../llvm/lib/Target/PowerPC/PPCInstrInfo.td        |   9 +
 .../llvm/lib/Target/PowerPC/PPCMCInstLower.cpp     |   4 -
 .../llvm/lib/Target/PowerPC/PPCScheduleP9.td       |   2 +-
 .../llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp      |  15 +-
 .../Target/RISCV/RISCVExpandAtomicPseudoInsts.cpp  |   9 +
 .../llvm/lib/Target/RISCV/RISCVFrameLowering.cpp   |  39 +--
 .../llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp    |  13 +-
 .../llvm/lib/Target/RISCV/RISCVISelLowering.cpp    |  26 +-
 .../lib/Target/RISCV/RISCVPushPopOptimizer.cpp     |   3 +-
 .../llvm/lib/Target/Sparc/SparcInstrInfo.td        |  16 ++
 .../Target/SystemZ/SystemZTargetTransformInfo.cpp  |   5 +
 contrib/llvm-project/llvm/lib/Target/X86/X86.td    |   7 +
 .../llvm/lib/Target/X86/X86ISelLowering.cpp        |  96 ++++---
 .../llvm/lib/Target/X86/X86ISelLowering.h          |   2 -
 .../llvm/lib/Target/X86/X86InstrAVX512.td          |  10 +
 .../llvm/lib/Target/X86/X86InstrSSE.td             |   5 +
 .../llvm/lib/Target/X86/X86TargetTransformInfo.cpp |  14 +-
 .../llvm/lib/Target/X86/X86TargetTransformInfo.h   |   1 +
 .../llvm-project/llvm/lib/TargetParser/Host.cpp    |  10 +-
 .../lib/TargetParser/LoongArchTargetParser.cpp     |  12 +
 .../AggressiveInstCombine.cpp                      | 217 ++++-----------
 .../llvm/lib/Transforms/Coroutines/CoroElide.cpp   |  83 ++++--
 .../lib/Transforms/IPO/FunctionSpecialization.cpp  |  82 +-----
 .../InstCombine/InstructionCombining.cpp           |   2 +-
 .../Instrumentation/ControlHeightReduction.cpp     |  14 +
 .../Transforms/Instrumentation/GCOVProfiling.cpp   |   4 +-
 .../Transforms/Scalar/ConstraintElimination.cpp    |   2 +-
 .../llvm/lib/Transforms/Scalar/JumpThreading.cpp   |   2 +
 .../llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | 256 +----------------
 .../Transforms/Scalar/TailRecursionElimination.cpp |   6 +
 .../llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp |  14 +-
 .../lib/Transforms/Vectorize/LoopVectorize.cpp     |  38 ++-
 .../llvm/tools/llvm-readobj/ELFDumper.cpp          |   2 +-
 .../openmp/runtime/src/ompt-event-specific.h       |  13 +-
 lib/clang/include/VCSVersion.inc                   |   6 +-
 lib/clang/include/lld/Common/Version.inc           |   2 +-
 lib/clang/include/lldb/Version/Version.inc         |   4 +-
 lib/clang/include/llvm/Config/config.h             |   4 +-
 lib/clang/include/llvm/Config/llvm-config.h        |   2 +-
 lib/clang/include/llvm/Support/VCSRevision.h       |   2 +-
 lib/libc++/__config_site                           |   1 +
 lib/libc++/module.modulemap                        |  65 ++---
 249 files changed, 3393 insertions(+), 2248 deletions(-)

diff --git a/contrib/llvm-project/clang/include/clang/AST/DeclBase.h b/contrib/llvm-project/clang/include/clang/AST/DeclBase.h
index 1b99709ca90d..12137387b676 100644
--- a/contrib/llvm-project/clang/include/clang/AST/DeclBase.h
+++ b/contrib/llvm-project/clang/include/clang/AST/DeclBase.h
@@ -1702,7 +1702,7 @@ class DeclContext {
   };
 
   /// Number of non-inherited bits in FunctionDeclBitfields.
-  enum { NumFunctionDeclBits = 30 };
+  enum { NumFunctionDeclBits = 31 };
 
   /// Stores the bits used by CXXConstructorDecl. If modified
   /// NumCXXConstructorDeclBits and the accessor
@@ -1714,12 +1714,12 @@ class DeclContext {
     /// For the bits in FunctionDeclBitfields.
     uint64_t : NumFunctionDeclBits;
 
-    /// 21 bits to fit in the remaining available space.
+    /// 20 bits to fit in the remaining available space.
     /// Note that this makes CXXConstructorDeclBitfields take
     /// exactly 64 bits and thus the width of NumCtorInitializers
     /// will need to be shrunk if some bit is added to NumDeclContextBitfields,
     /// NumFunctionDeclBitfields or CXXConstructorDeclBitfields.
-    uint64_t NumCtorInitializers : 18;
+    uint64_t NumCtorInitializers : 17;
     uint64_t IsInheritingConstructor : 1;
 
     /// Whether this constructor has a trail-allocated explicit specifier.
diff --git a/contrib/llvm-project/clang/include/clang/AST/ExprConcepts.h b/contrib/llvm-project/clang/include/clang/AST/ExprConcepts.h
index d900e980852b..13d4568119eb 100644
--- a/contrib/llvm-project/clang/include/clang/AST/ExprConcepts.h
+++ b/contrib/llvm-project/clang/include/clang/AST/ExprConcepts.h
@@ -14,20 +14,21 @@
 #ifndef LLVM_CLANG_AST_EXPRCONCEPTS_H
 #define LLVM_CLANG_AST_EXPRCONCEPTS_H
 
-#include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTConcept.h"
+#include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
-#include "clang/AST/DeclarationName.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/DeclarationName.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/TemplateBase.h"
 #include "clang/AST/Type.h"
 #include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/TrailingObjects.h"
-#include <utility>
 #include <string>
+#include <utility>
 
 namespace clang {
 class ASTStmtReader;
@@ -467,6 +468,13 @@ public:
   }
 };
 
+using EntityPrinter = llvm::function_ref<void(llvm::raw_ostream &)>;
+
+/// \brief create a Requirement::SubstitutionDiagnostic with only a
+/// SubstitutedEntity and DiagLoc using Sema's allocator.
+Requirement::SubstitutionDiagnostic *
+createSubstDiagAt(Sema &S, SourceLocation Location, EntityPrinter Printer);
+
 } // namespace concepts
 
 /// C++2a [expr.prim.req]:
diff --git a/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.def b/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.def
index 11aec88c5335..d492b8681c5d 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.def
+++ b/contrib/llvm-project/clang/include/clang/Basic/CodeGenOptions.def
@@ -165,7 +165,6 @@ CODEGENOPT(PrepareForThinLTO , 1, 0) ///< Set when -flto=thin is enabled on the
                                      ///< compile step.
 CODEGENOPT(LTOUnit, 1, 0) ///< Emit IR to support LTO unit features (CFI, whole
                           ///< program vtable opt).
-CODEGENOPT(FatLTO, 1, 0) ///< Set when -ffat-lto-objects is enabled.
 CODEGENOPT(EnableSplitLTOUnit, 1, 0) ///< Enable LTO unit splitting to support
 				     /// CFI and traditional whole program
 				     /// devirtualization that require whole
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticASTKinds.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticASTKinds.td
index 566cdc340605..0794ed7ba683 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -70,6 +70,8 @@ def note_consteval_address_accessible : Note<
   "is not a constant expression">;
 def note_constexpr_uninitialized : Note<
   "subobject %0 is not initialized">;
+def note_constexpr_uninitialized_base : Note<
+  "constructor of base class %0 is not called">;
 def note_constexpr_static_local : Note<
   "control flows through the definition of a %select{static|thread_local}0 variable">;
 def note_constexpr_subobject_declared_here : Note<
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td
index 7b4d415bf064..26bc88a980e4 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticGroups.td
@@ -20,6 +20,7 @@ def DeprecatedStaticAnalyzerFlag : DiagGroup<"deprecated-static-analyzer-flag">;
 // Empty DiagGroups are recognized by clang but ignored.
 def ODR : DiagGroup<"odr">;
 def : DiagGroup<"abi">;
+def : DiagGroup<"gnu-empty-initializer">; // Now a C extension, not GNU.
 def AbsoluteValue : DiagGroup<"absolute-value">;
 def MisspelledAssumption : DiagGroup<"misspelled-assumption">;
 def UnknownAssumption : DiagGroup<"unknown-assumption">;
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td
index 0eb270aeea0e..6ad691975bd5 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -285,6 +285,10 @@ def ext_ms_reserved_user_defined_literal : ExtWarn<
 def err_unsupported_string_concat : Error<
   "unsupported non-standard concatenation of string literals">;
 
+def warn_unevaluated_string_prefix : Warning<
+  "encoding prefix '%0' on an unevaluated string literal has no effect"
+  "%select{| and is incompatible with c++2c}1">,
+  InGroup<DiagGroup<"invalid-unevaluated-string">>;
 def err_unevaluated_string_prefix : Error<
   "an unevaluated string literal cannot have an encoding prefix">;
 def err_unevaluated_string_udl : Error<
diff --git a/contrib/llvm-project/clang/include/clang/Basic/Sanitizers.h b/contrib/llvm-project/clang/include/clang/Basic/Sanitizers.h
index db53010645ae..4659e45c7883 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/Sanitizers.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/Sanitizers.h
@@ -23,7 +23,11 @@
 
 namespace llvm {
 class hash_code;
+class Triple;
+namespace opt {
+class ArgList;
 }
+} // namespace llvm
 
 namespace clang {
 
diff --git a/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h b/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
index 41ef47eb565b..61be52149341 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
@@ -1414,7 +1414,9 @@ public:
 
   /// Identify whether this target supports IFuncs.
   bool supportsIFunc() const {
-    return getTriple().isOSBinFormatELF() && !getTriple().isOSFuchsia();
+    return getTriple().isOSBinFormatELF() &&
+           ((getTriple().isOSLinux() && !getTriple().isMusl()) ||
+            getTriple().isOSFreeBSD());
   }
 
   // Validate the contents of the __builtin_cpu_supports(const char*)
diff --git a/contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td b/contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td
index 7e5889812aec..6adc60031341 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/riscv_vector.td
@@ -112,7 +112,7 @@ multiclass RVVIntBinBuiltinSet
 multiclass RVVSlideOneBuiltinSet
     : RVVOutOp1BuiltinSet<NAME, "csil",
                           [["vx", "v", "vve"],
-                           ["vx", "Uv", "UvUve"]]>;
+                           ["vx", "Uv", "UvUvUe"]]>;
 
 multiclass RVVSignedShiftBuiltinSet
     : RVVOutOp1BuiltinSet<NAME, "csil",
@@ -990,56 +990,6 @@ multiclass RVVPseudoVNCVTBuiltin<string IR, string MName, string type_range,
   }
 }
 
-// Define vread_csr&vwrite_csr described in RVV intrinsics doc.
-let HeaderCode =
-[{
-enum RVV_CSR {
-  RVV_VSTART = 0,
-  RVV_VXSAT,
-  RVV_VXRM,
-  RVV_VCSR,
-};
-
-static __inline__ __attribute__((__always_inline__, __nodebug__))
-unsigned long __riscv_vread_csr(enum RVV_CSR __csr) {
-  unsigned long __rv = 0;
-  switch (__csr) {
-    case RVV_VSTART:
-      __asm__ __volatile__ ("csrr\t%0, vstart" : "=r"(__rv) : : "memory");
-      break;
-    case RVV_VXSAT:
-      __asm__ __volatile__ ("csrr\t%0, vxsat" : "=r"(__rv) : : "memory");
-      break;
-    case RVV_VXRM:
-      __asm__ __volatile__ ("csrr\t%0, vxrm" : "=r"(__rv) : : "memory");
-      break;
-    case RVV_VCSR:
-      __asm__ __volatile__ ("csrr\t%0, vcsr" : "=r"(__rv) : : "memory");
-      break;
-  }
-  return __rv;
-}
-
-static __inline__ __attribute__((__always_inline__, __nodebug__))
-void __riscv_vwrite_csr(enum RVV_CSR __csr, unsigned long __value) {
-  switch (__csr) {
-    case RVV_VSTART:
-      __asm__ __volatile__ ("csrw\tvstart, %z0" : : "rJ"(__value) : "memory");
-      break;
-    case RVV_VXSAT:
-      __asm__ __volatile__ ("csrw\tvxsat, %z0" : : "rJ"(__value) : "memory");
-      break;
-    case RVV_VXRM:
-      __asm__ __volatile__ ("csrw\tvxrm, %z0" : : "rJ"(__value) : "memory");
-      break;
-    case RVV_VCSR:
-      __asm__ __volatile__ ("csrw\tvcsr, %z0" : : "rJ"(__value) : "memory");
-      break;
-  }
-}
-}] in
-def vread_vwrite_csr: RVVHeader;
-
 let HeaderCode =
 [{
 #define __riscv_vlenb() __builtin_rvv_vlenb()
diff --git a/contrib/llvm-project/clang/include/clang/CodeGen/CGFunctionInfo.h b/contrib/llvm-project/clang/include/clang/CodeGen/CGFunctionInfo.h
index 39c7a578c8c4..b8971d5793f3 100644
--- a/contrib/llvm-project/clang/include/clang/CodeGen/CGFunctionInfo.h
+++ b/contrib/llvm-project/clang/include/clang/CodeGen/CGFunctionInfo.h
@@ -567,6 +567,10 @@ class CGFunctionInfo final
   /// Whether this is a chain call.
   unsigned ChainCall : 1;
 
+  /// Whether this function is called by forwarding arguments.
+  /// This doesn't support inalloca or varargs.
+  unsigned DelegateCall : 1;
+
   /// Whether this function is a CMSE nonsecure call
   unsigned CmseNSCall : 1;
 
@@ -616,14 +620,11 @@ class CGFunctionInfo final
   CGFunctionInfo() : Required(RequiredArgs::All) {}
 
 public:
-  static CGFunctionInfo *create(unsigned llvmCC,
-                                bool instanceMethod,
-                                bool chainCall,
-                                const FunctionType::ExtInfo &extInfo,
-                                ArrayRef<ExtParameterInfo> paramInfos,
-                                CanQualType resultType,
-                                ArrayRef<CanQualType> argTypes,
-                                RequiredArgs required);
+  static CGFunctionInfo *
+  create(unsigned llvmCC, bool instanceMethod, bool chainCall,
+         bool delegateCall, const FunctionType::ExtInfo &extInfo,
+         ArrayRef<ExtParameterInfo> paramInfos, CanQualType resultType,
+         ArrayRef<CanQualType> argTypes, RequiredArgs required);
   void operator delete(void *p) { ::operator delete(p); }
 
   // Friending class TrailingObjects is apparently not good enough for MSVC,
@@ -663,6 +664,8 @@ public:
 
   bool isChainCall() const { return ChainCall; }
 
+  bool isDelegateCall() const { return DelegateCall; }
+
   bool isCmseNSCall() const { return CmseNSCall; }
 
   bool isNoReturn() const { return NoReturn; }
@@ -749,6 +752,7 @@ public:
     ID.AddInteger(getASTCallingConvention());
     ID.AddBoolean(InstanceMethod);
     ID.AddBoolean(ChainCall);
+    ID.AddBoolean(DelegateCall);
     ID.AddBoolean(NoReturn);
     ID.AddBoolean(ReturnsRetained);
     ID.AddBoolean(NoCallerSavedRegs);
@@ -766,17 +770,16 @@ public:
     for (const auto &I : arguments())
       I.type.Profile(ID);
   }
-  static void Profile(llvm::FoldingSetNodeID &ID,
-                      bool InstanceMethod,
-                      bool ChainCall,
+  static void Profile(llvm::FoldingSetNodeID &ID, bool InstanceMethod,
+                      bool ChainCall, bool IsDelegateCall,
                       const FunctionType::ExtInfo &info,
                       ArrayRef<ExtParameterInfo> paramInfos,
-                      RequiredArgs required,
-                      CanQualType resultType,
+                      RequiredArgs required, CanQualType resultType,
                       ArrayRef<CanQualType> argTypes) {
     ID.AddInteger(info.getCC());
     ID.AddBoolean(InstanceMethod);
     ID.AddBoolean(ChainCall);
+    ID.AddBoolean(IsDelegateCall);
     ID.AddBoolean(info.getNoReturn());
     ID.AddBoolean(info.getProducesResult());
     ID.AddBoolean(info.getNoCallerSavedRegs());
diff --git a/contrib/llvm-project/clang/include/clang/Driver/Options.td b/contrib/llvm-project/clang/include/clang/Driver/Options.td
index 229f6141c750..e04f67bdb1fa 100644
--- a/contrib/llvm-project/clang/include/clang/Driver/Options.td
+++ b/contrib/llvm-project/clang/include/clang/Driver/Options.td
@@ -2375,11 +2375,6 @@ def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
   Flags<[CoreOption, CC1Option]>, Group<f_Group>,
   HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">,
   MarshallingInfoString<CodeGenOpts<"ThinLinkBitcodeFile">>;
-defm fat_lto_objects : BoolFOption<"fat-lto-objects",
-  CodeGenOpts<"FatLTO">, DefaultFalse,
-  PosFlag<SetTrue, [CC1Option], "Enable">,
-  NegFlag<SetFalse, [CC1Option], "Disable">,
-  BothFlags<[CC1Option], " fat LTO object support">>;
 def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
   Group<f_Group>, Flags<[NoXarchOption, CC1Option, CoreOption]>,
   HelpText<"Set the maximum number of entries to print in a macro expansion backtrace (0 = no limit)">,
@@ -5097,6 +5092,10 @@ def mretpoline_external_thunk : Flag<["-"], "mretpoline-external-thunk">, Group<
 def mno_retpoline_external_thunk : Flag<["-"], "mno-retpoline-external-thunk">, Group<m_x86_Features_Group>;
 def mvzeroupper : Flag<["-"], "mvzeroupper">, Group<m_x86_Features_Group>;
 def mno_vzeroupper : Flag<["-"], "mno-vzeroupper">, Group<m_x86_Features_Group>;
+def mno_gather : Flag<["-"], "mno-gather">, Group<m_x86_Features_Group>,
+                 HelpText<"Disable generation of gather instructions in auto-vectorization(x86 only)">;
+def mno_scatter : Flag<["-"], "mno-scatter">, Group<m_x86_Features_Group>,
+                  HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
 
 // These are legacy user-facing driver-level option spellings. They are always
 // aliases for options that are spelled using the more common Unix / GNU flag
@@ -5162,6 +5161,7 @@ defm caller_saves : BooleanFFlag<"caller-saves">, Group<clang_ignored_gcc_optimi
 defm reorder_blocks : BooleanFFlag<"reorder-blocks">, Group<clang_ignored_gcc_optimization_f_Group>;
 defm branch_count_reg : BooleanFFlag<"branch-count-reg">, Group<clang_ignored_gcc_optimization_f_Group>;
 defm default_inline : BooleanFFlag<"default-inline">, Group<clang_ignored_gcc_optimization_f_Group>;
+defm fat_lto_objects : BooleanFFlag<"fat-lto-objects">, Group<clang_ignored_gcc_optimization_f_Group>;
 defm float_store : BooleanFFlag<"float-store">, Group<clang_ignored_gcc_optimization_f_Group>;
 defm friend_injection : BooleanFFlag<"friend-injection">, Group<clang_ignored_f_Group>;
 defm function_attribute_list : BooleanFFlag<"function-attribute-list">, Group<clang_ignored_f_Group>;
@@ -7152,6 +7152,10 @@ def _SLASH_QIntel_jcc_erratum : CLFlag<"QIntel-jcc-erratum">,
   Alias<mbranches_within_32B_boundaries>;
 def _SLASH_arm64EC : CLFlag<"arm64EC">,
   HelpText<"Set build target to arm64ec">;
+def : CLFlag<"Qgather-">, Alias<mno_gather>,
+      HelpText<"Disable generation of gather instructions in auto-vectorization(x86 only)">;
+def : CLFlag<"Qscatter-">, Alias<mno_scatter>,
+      HelpText<"Disable generation of scatter instructions in auto-vectorization(x86 only)">;
 
 // Non-aliases:
 
diff --git a/contrib/llvm-project/clang/include/clang/Driver/ToolChain.h b/contrib/llvm-project/clang/include/clang/Driver/ToolChain.h
index e3fcbd9322b0..2e74507f7126 100644
--- a/contrib/llvm-project/clang/include/clang/Driver/ToolChain.h
+++ b/contrib/llvm-project/clang/include/clang/Driver/ToolChain.h
@@ -561,7 +561,7 @@ public:
 
   // Return the DWARF version to emit, in the absence of arguments
   // to the contrary.
-  virtual unsigned GetDefaultDwarfVersion() const { return 5; }
+  virtual unsigned GetDefaultDwarfVersion() const;
 
   // Some toolchains may have different restrictions on the DWARF version and
   // may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
diff --git a/contrib/llvm-project/clang/include/clang/Sema/Sema.h b/contrib/llvm-project/clang/include/clang/Sema/Sema.h
index 3418a37b3077..cfd1c0f977c0 100644
--- a/contrib/llvm-project/clang/include/clang/Sema/Sema.h
+++ b/contrib/llvm-project/clang/include/clang/Sema/Sema.h
@@ -12694,8 +12694,6 @@ public:
   QualType CheckBitwiseOperands( // C99 6.5.[10...12]
       ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
       BinaryOperatorKind Opc);
-  void diagnoseLogicalInsteadOfBitwise(Expr *Op1, Expr *Op2, SourceLocation Loc,
-                                       BinaryOperatorKind Opc);
   QualType CheckLogicalOperands( // C99 6.5.[13,14]
     ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
     BinaryOperatorKind Opc);
diff --git a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
index 7acacd7bf4f5..76000156fece 100644
--- a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
@@ -9612,9 +9612,8 @@ bool ASTContext::areLaxCompatibleRVVTypes(QualType FirstType,
       const LangOptions::LaxVectorConversionKind LVCKind =
           getLangOpts().getLaxVectorConversions();
 
-      // If __riscv_v_fixed_vlen != N do not allow GNU vector lax conversion.
-      if (VecTy->getVectorKind() == VectorType::GenericVector &&
-          getTypeSize(SecondType) != getRVVTypeSize(*this, BT))
+      // If __riscv_v_fixed_vlen != N do not allow vector lax conversion.
+      if (getTypeSize(SecondType) != getRVVTypeSize(*this, BT))
         return false;
 
       // If -flax-vector-conversions=all is specified, the types are
diff --git a/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp b/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp
index f1c842e26199..f1bad0c7f7f2 100644
--- a/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp
@@ -2418,9 +2418,16 @@ static bool CheckEvaluationResult(CheckEvaluationResultKind CERK,
     if (const CXXRecordDecl *CD = dyn_cast<CXXRecordDecl>(RD)) {
       unsigned BaseIndex = 0;
       for (const CXXBaseSpecifier &BS : CD->bases()) {
-        if (!CheckEvaluationResult(CERK, Info, DiagLoc, BS.getType(),
-                                   Value.getStructBase(BaseIndex), Kind,
-                                   /*SubobjectDecl=*/nullptr, CheckedTemps))
+        const APValue &BaseValue = Value.getStructBase(BaseIndex);
+        if (!BaseValue.hasValue()) {
+          SourceLocation TypeBeginLoc = BS.getBaseTypeLoc();
+          Info.FFDiag(TypeBeginLoc, diag::note_constexpr_uninitialized_base)
+              << BS.getType() << SourceRange(TypeBeginLoc, BS.getEndLoc());
+          return false;
+        }
+        if (!CheckEvaluationResult(CERK, Info, DiagLoc, BS.getType(), BaseValue,
+                                   Kind, /*SubobjectDecl=*/nullptr,
+                                   CheckedTemps))
           return false;
         ++BaseIndex;
       }
@@ -15218,14 +15225,6 @@ static bool FastEvaluateAsRValue(const Expr *Exp, Expr::EvalResult &Result,
     return true;
   }
 
-  // FIXME: Evaluating values of large array and record types can cause
-  // performance problems. Only do so in C++11 for now.
-  if (Exp->isPRValue() &&
-      (Exp->getType()->isArrayType() || Exp->getType()->isRecordType()) &&
-      !Ctx.getLangOpts().CPlusPlus11) {
-    IsConst = false;
-    return true;
-  }
   return false;
 }
 
@@ -15467,12 +15466,6 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx,
     return Name;
   });
 
-  // FIXME: Evaluating initializers for large array and record types can cause
-  // performance problems. Only do so in C++11 for now.
-  if (isPRValue() && (getType()->isArrayType() || getType()->isRecordType()) &&
-      !Ctx.getLangOpts().CPlusPlus11)
-    return false;
-
   Expr::EvalStatus EStatus;
   EStatus.Diag = &Notes;
 
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/LoongArch.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/LoongArch.cpp
index 6958479cd7c4..4448a2ae10a1 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/LoongArch.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/LoongArch.cpp
@@ -15,7 +15,7 @@
 #include "clang/Basic/MacroBuilder.h"
 #include "clang/Basic/TargetBuiltins.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/TargetParser/TargetParser.h"
+#include "llvm/TargetParser/LoongArchTargetParser.h"
 
 using namespace clang;
 using namespace clang::targets;
@@ -198,7 +198,15 @@ void LoongArchTargetInfo::getTargetDefines(const LangOptions &Opts,
   else
     Builder.defineMacro("__loongarch_frlen", "0");
 
-  // TODO: define __loongarch_arch and __loongarch_tune.
+  // Define __loongarch_arch.
+  StringRef ArchName = getCPU();
+  Builder.defineMacro("__loongarch_arch", Twine('"') + ArchName + Twine('"'));
+
+  // Define __loongarch_tune.
+  StringRef TuneCPU = getTargetOpts().TuneCPU;
+  if (TuneCPU.empty())
+    TuneCPU = ArchName;
+  Builder.defineMacro("__loongarch_tune", Twine('"') + TuneCPU + Twine('"'));
 
   StringRef ABI = getABI();
   if (ABI == "lp64d" || ABI == "lp64f" || ABI == "lp64s")
@@ -270,3 +278,12 @@ bool LoongArchTargetInfo::handleTargetFeatures(
   }
   return true;
 }
+
+bool LoongArchTargetInfo::isValidCPUName(StringRef Name) const {
+  return llvm::LoongArch::isValidCPUName(Name);
+}
+
+void LoongArchTargetInfo::fillValidCPUList(
+    SmallVectorImpl<StringRef> &Values) const {
+  llvm::LoongArch::fillValidCPUList(Values);
+}
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/LoongArch.h b/contrib/llvm-project/clang/lib/Basic/Targets/LoongArch.h
index 52c4ce425368..34143f462a24 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/LoongArch.h
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/LoongArch.h
@@ -24,6 +24,7 @@ namespace targets {
 class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
 protected:
   std::string ABI;
+  std::string CPU;
   bool HasFeatureD;
   bool HasFeatureF;
 
@@ -40,6 +41,15 @@ public:
     WIntType = UnsignedInt;
   }
 
+  bool setCPU(const std::string &Name) override {
+    if (!isValidCPUName(Name))
+      return false;
+    CPU = Name;
+    return true;
+  }
+
+  StringRef getCPU() const { return CPU; }
+
   StringRef getABI() const override { return ABI; }
 
   void getTargetDefines(const LangOptions &Opts,
@@ -80,6 +90,9 @@ public:
                  const std::vector<std::string> &FeaturesVec) const override;
 
   bool hasFeature(StringRef Feature) const override;
+
+  bool isValidCPUName(StringRef Name) const override;
+  void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
 };
 
 class LLVM_LIBRARY_VISIBILITY LoongArch32TargetInfo
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
index 94c894dfec0b..d55ab76395c8 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/RISCV.cpp
@@ -196,8 +196,8 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
 
   if (ISAInfo->hasExtension("zve32x")) {
     Builder.defineMacro("__riscv_vector");
-    // Currently we support the v0.11 RISC-V V intrinsics.
-    Builder.defineMacro("__riscv_v_intrinsic", Twine(getVersionValue(0, 11)));
+    // Currently we support the v0.12 RISC-V V intrinsics.
+    Builder.defineMacro("__riscv_v_intrinsic", Twine(getVersionValue(0, 12)));
   }
 
   auto VScale = getVScaleRange(Opts);
diff --git a/contrib/llvm-project/clang/lib/CodeGen/ABIInfoImpl.cpp b/contrib/llvm-project/clang/lib/CodeGen/ABIInfoImpl.cpp
index 7c30cecfdb9b..2b20d5a13346 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/ABIInfoImpl.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/ABIInfoImpl.cpp
@@ -246,7 +246,7 @@ Address CodeGen::emitMergePHI(CodeGenFunction &CGF, Address Addr1,
 }
 
 bool CodeGen::isEmptyField(ASTContext &Context, const FieldDecl *FD,
-                           bool AllowArrays) {
+                           bool AllowArrays, bool AsIfNoUniqueAddr) {
   if (FD->isUnnamedBitfield())
     return true;
 
@@ -280,13 +280,14 @@ bool CodeGen::isEmptyField(ASTContext &Context, const FieldDecl *FD,
   // not arrays of records, so we must also check whether we stripped off an
   // array type above.
   if (isa<CXXRecordDecl>(RT->getDecl()) &&
-      (WasArray || !FD->hasAttr<NoUniqueAddressAttr>()))
+      (WasArray || (!AsIfNoUniqueAddr && !FD->hasAttr<NoUniqueAddressAttr>())))
     return false;
 
-  return isEmptyRecord(Context, FT, AllowArrays);
+  return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr);
 }
 
-bool CodeGen::isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays) {
+bool CodeGen::isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays,
+                            bool AsIfNoUniqueAddr) {
   const RecordType *RT = T->getAs<RecordType>();
   if (!RT)
     return false;
@@ -297,11 +298,11 @@ bool CodeGen::isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays) {
   // If this is a C++ record, check the bases first.
   if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
     for (const auto &I : CXXRD->bases())
-      if (!isEmptyRecord(Context, I.getType(), true))
+      if (!isEmptyRecord(Context, I.getType(), true, AsIfNoUniqueAddr))
         return false;
 
   for (const auto *I : RD->fields())
-    if (!isEmptyField(Context, I, AllowArrays))
+    if (!isEmptyField(Context, I, AllowArrays, AsIfNoUniqueAddr))
       return false;
   return true;
 }
diff --git a/contrib/llvm-project/clang/lib/CodeGen/ABIInfoImpl.h b/contrib/llvm-project/clang/lib/CodeGen/ABIInfoImpl.h
index 5f0cc289af68..afde08ba100c 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/ABIInfoImpl.h
+++ b/contrib/llvm-project/clang/lib/CodeGen/ABIInfoImpl.h
@@ -122,13 +122,19 @@ Address emitMergePHI(CodeGenFunction &CGF, Address Addr1,
                      llvm::BasicBlock *Block2, const llvm::Twine &Name = "");
 
 /// isEmptyField - Return true iff a the field is "empty", that is it
-/// is an unnamed bit-field or an (array of) empty record(s).
-bool isEmptyField(ASTContext &Context, const FieldDecl *FD, bool AllowArrays);
+/// is an unnamed bit-field or an (array of) empty record(s). If
+/// AsIfNoUniqueAddr is true, then C++ record fields are considered empty if
+/// the [[no_unique_address]] attribute would have made them empty.
+bool isEmptyField(ASTContext &Context, const FieldDecl *FD, bool AllowArrays,
+                  bool AsIfNoUniqueAddr = false);
 
 /// isEmptyRecord - Return true iff a structure contains only empty
 /// fields. Note that a structure with a flexible array member is not
-/// considered empty.
-bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays);
+/// considered empty. If AsIfNoUniqueAddr is true, then C++ record fields are
+/// considered empty if the [[no_unique_address]] attribute would have made
+/// them empty.
+bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays,
+                   bool AsIfNoUniqueAddr = false);
 
 /// isSingleElementStruct - Determine if a structure is a "single
 /// element struct", i.e. it has exactly one non-empty field or
diff --git a/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp b/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp
index cda03d69522d..483f3e787a78 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp
@@ -55,7 +55,6 @@
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/TargetParser/SubtargetFeature.h"
 #include "llvm/TargetParser/Triple.h"
-#include "llvm/Transforms/IPO/EmbedBitcodePass.h"
 #include "llvm/Transforms/IPO/LowerTypeTests.h"
 #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
 #include "llvm/Transforms/InstCombine/InstCombine.h"
@@ -1016,12 +1015,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
           });
     }
 
-    bool IsThinOrUnifiedLTO = IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO);
-    if (CodeGenOpts.FatLTO) {
-      MPM = PB.buildFatLTODefaultPipeline(Level, IsThinOrUnifiedLTO,
-                                          IsThinOrUnifiedLTO ||
-                                              shouldEmitRegularLTOSummary());
-    } else if (IsThinOrUnifiedLTO) {
+    if (IsThinLTO || (IsLTO && CodeGenOpts.UnifiedLTO)) {
       MPM = PB.buildThinLTOPreLinkDefaultPipeline(Level);
     } else if (IsLTO) {
       MPM = PB.buildLTOPreLinkDefaultPipeline(Level);
@@ -1077,21 +1071,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
                                     EmitLTOSummary));
     }
   }
-  if (CodeGenOpts.FatLTO) {
-    // Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
-    // uses a different action than Backend_EmitBC or Backend_EmitLL.
-    bool IsThinOrUnifiedLTO =
-        CodeGenOpts.PrepareForThinLTO ||
-        (CodeGenOpts.PrepareForLTO && CodeGenOpts.UnifiedLTO);
-    if (!TheModule->getModuleFlag("ThinLTO"))
-      TheModule->addModuleFlag(Module::Error, "ThinLTO",
-                               uint32_t(IsThinOrUnifiedLTO));
-    if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
-      TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit",
-                               uint32_t(CodeGenOpts.EnableSplitLTOUnit));
-    if (CodeGenOpts.UnifiedLTO && !TheModule->getModuleFlag("UnifiedLTO"))
-      TheModule->addModuleFlag(Module::Error, "UnifiedLTO", uint32_t(1));
-  }
 
   // Now that we have all of the passes ready, run them.
   {
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGCXXABI.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGCXXABI.cpp
index 7b77dd7875bc..4df6f6505ef6 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGCXXABI.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGCXXABI.cpp
@@ -312,8 +312,7 @@ void CGCXXABI::setCXXDestructorDLLStorage(llvm::GlobalValue *GV,
 llvm::GlobalValue::LinkageTypes CGCXXABI::getCXXDestructorLinkage(
     GVALinkage Linkage, const CXXDestructorDecl *Dtor, CXXDtorType DT) const {
   // Delegate back to CGM by default.
-  return CGM.getLLVMLinkageForDeclarator(Dtor, Linkage,
-                                         /*IsConstantVariable=*/false);
+  return CGM.getLLVMLinkageForDeclarator(Dtor, Linkage);
 }
 
 bool CGCXXABI::NeedsVTTParameter(GlobalDecl GD) {
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp
index bd272e016e92..0d1e9ad439b7 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp
@@ -13,6 +13,7 @@
 
 #include "CGCall.h"
 #include "ABIInfo.h"
+#include "ABIInfoImpl.h"
 #include "CGBlocks.h"
 #include "CGCXXABI.h"
 #include "CGCleanup.h"
@@ -112,8 +113,7 @@ CodeGenTypes::arrangeFreeFunctionType(CanQual<FunctionNoProtoType> FTNP) {
   // When translating an unprototyped function type, always use a
   // variadic type.
   return arrangeLLVMFunctionInfo(FTNP->getReturnType().getUnqualifiedType(),
-                                 /*instanceMethod=*/false,
-                                 /*chainCall=*/false, std::nullopt,
+                                 FnInfoOpts::None, std::nullopt,
                                  FTNP->getExtInfo(), {}, RequiredArgs(0));
 }
 
@@ -189,10 +189,10 @@ arrangeLLVMFunctionInfo(CodeGenTypes &CGT, bool instanceMethod,
   appendParameterTypes(CGT, prefix, paramInfos, FTP);
   CanQualType resultType = FTP->getReturnType().getUnqualifiedType();
 
-  return CGT.arrangeLLVMFunctionInfo(resultType, instanceMethod,
-                                     /*chainCall=*/false, prefix,
-                                     FTP->getExtInfo(), paramInfos,
-                                     Required);
+  FnInfoOpts opts =
+      instanceMethod ? FnInfoOpts::IsInstanceMethod : FnInfoOpts::None;
+  return CGT.arrangeLLVMFunctionInfo(resultType, opts, prefix,
+                                     FTP->getExtInfo(), paramInfos, Required);
 }
 
 /// Arrange the argument and result information for a value of the
@@ -271,7 +271,7 @@ CodeGenTypes::arrangeCXXMethodType(const CXXRecordDecl *RD,
   argTypes.push_back(DeriveThisType(RD, MD));
 
   return ::arrangeLLVMFunctionInfo(
-      *this, true, argTypes,
+      *this, /*instanceMethod=*/true, argTypes,
       FTP->getCanonicalTypeUnqualified().getAs<FunctionProtoType>());
 }
 
*** 11179 LINES SKIPPED ***