git: 2e2f8eac752c - stable/13 - Merge llvm-project release/13.x llvmorg-13.0.0-rc1-97-g23ba3732246a

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 06 Dec 2021 16:33:14 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=2e2f8eac752cf13bc0f0c5aabf0ae9e5ef22c360

commit 2e2f8eac752cf13bc0f0c5aabf0ae9e5ef22c360
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-08-25 18:31:14 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2021-12-06 16:30:03 +0000

    Merge llvm-project release/13.x llvmorg-13.0.0-rc1-97-g23ba3732246a
    
    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvmorg-13.0.0-rc1-97-g23ba3732246a.
    
    PR:             258209
    
    (cherry picked from commit 6e75b2fbf9a03e6876e0a3c089e0b3ad71876125)
---
 ObsoleteFiles.inc                                  |  146 +++
 .../clang/include/clang/Basic/BuiltinsAArch64.def  |    3 +
 .../include/clang/Basic/DiagnosticDriverKinds.td   |    2 -
 .../include/clang/Basic/DiagnosticLexKinds.td      |    7 +
 .../include/clang/Basic/DiagnosticSemaKinds.td     |    2 -
 .../clang/include/clang/Basic/LangOptions.def      |    2 +-
 .../clang/include/clang/Basic/LangOptions.h        |    6 +
 .../clang/include/clang/Driver/Options.td          |    9 +-
 .../clang/include/clang/Driver/Types.h             |    8 -
 .../clang/Frontend/PreprocessorOutputOptions.h     |    2 -
 .../clang/include/clang/Lex/HeaderSearch.h         |   17 +-
 .../clang/include/clang/Lex/Preprocessor.h         |    5 +-
 .../clang/include/clang/Lex/PreprocessorLexer.h    |   20 +-
 .../clang/include/clang/Lex/PreprocessorOptions.h  |    3 -
 .../llvm-project/clang/include/clang/Sema/Sema.h   |    3 +-
 contrib/llvm-project/clang/lib/AST/ASTContext.cpp  |   20 +-
 contrib/llvm-project/clang/lib/AST/Expr.cpp        |    7 +-
 .../llvm-project/clang/lib/Basic/LangOptions.cpp   |    8 +
 .../llvm-project/clang/lib/Basic/OpenCLOptions.cpp |    7 +-
 .../llvm-project/clang/lib/Basic/TargetInfo.cpp    |   10 +-
 .../clang/lib/Basic/Targets/AArch64.cpp            |    6 +-
 .../llvm-project/clang/lib/Basic/Targets/AMDGPU.h  |    5 +-
 .../llvm-project/clang/lib/CodeGen/CGBuiltin.cpp   |   23 +
 .../llvm-project/clang/lib/CodeGen/CGDeclCXX.cpp   |   18 +-
 contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp  |   43 +-
 .../clang/lib/CodeGen/CodeGenModule.cpp            |    2 +-
 .../llvm-project/clang/lib/CodeGen/TargetInfo.cpp  |   14 +
 .../llvm-project/clang/lib/CodeGen/TargetInfo.h    |    7 +
 .../clang/lib/Driver/ToolChains/Clang.cpp          |   53 +-
 .../clang/lib/Driver/ToolChains/Hexagon.cpp        |   32 +-
 .../clang/lib/Driver/ToolChains/MinGW.cpp          |    7 +-
 contrib/llvm-project/clang/lib/Driver/Types.cpp    |   39 -
 .../clang/lib/Format/WhitespaceManager.cpp         |    2 +-
 .../clang/lib/Frontend/CompilerInvocation.cpp      |   20 +-
 .../clang/lib/Frontend/PrintPreprocessedOutput.cpp |  349 +++----
 contrib/llvm-project/clang/lib/Headers/intrin.h    |    3 +
 contrib/llvm-project/clang/lib/Lex/Lexer.cpp       |    4 +-
 .../llvm-project/clang/lib/Lex/PPDirectives.cpp    |    4 +
 .../llvm-project/clang/lib/Lex/PPLexerChange.cpp   |   45 +-
 .../clang/lib/Lex/PPMacroExpansion.cpp             |   11 +-
 contrib/llvm-project/clang/lib/Lex/Pragma.cpp      |   92 +-
 .../llvm-project/clang/lib/Lex/Preprocessor.cpp    |    6 -
 contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp |   16 +-
 contrib/llvm-project/clang/lib/Sema/Sema.cpp       |    3 +-
 .../llvm-project/clang/lib/Sema/SemaConcept.cpp    |   17 +-
 .../llvm-project/clang/lib/Sema/SemaDeclCXX.cpp    |    5 +-
 .../llvm-project/clang/lib/Sema/SemaTemplate.cpp   |    9 +-
 .../clang/lib/Sema/SemaTemplateInstantiate.cpp     |   19 +-
 contrib/llvm-project/clang/lib/Sema/SemaType.cpp   |   47 +-
 .../compiler-rt/include/profile/InstrProfData.inc  |    4 +-
 .../compiler-rt/lib/profile/InstrProfilingBuffer.c |    2 +-
 .../compiler-rt/lib/profile/InstrProfilingMerge.c  |   11 +-
 .../lib/profile/InstrProfilingPlatformLinux.c      |   19 +
 contrib/llvm-project/libcxx/include/__config       |   11 +
 contrib/llvm-project/libcxx/include/ctime          |    2 +-
 contrib/llvm-project/libcxx/include/format         |   12 +-
 contrib/llvm-project/libcxx/include/ios            |    7 +
 contrib/llvm-project/libcxx/include/ranges         |   12 +-
 contrib/llvm-project/lld/ELF/Config.h              |   10 +-
 contrib/llvm-project/lld/ELF/Driver.cpp            |   71 +-
 contrib/llvm-project/lld/ELF/LinkerScript.cpp      |   36 +-
 contrib/llvm-project/lld/ELF/LinkerScript.h        |    2 +-
 contrib/llvm-project/lld/ELF/Options.td            |    3 +
 contrib/llvm-project/lld/ELF/Relocations.cpp       |    7 +
 contrib/llvm-project/lld/ELF/ScriptParser.cpp      |    9 +-
 contrib/llvm-project/lld/ELF/SymbolTable.cpp       |  118 ++-
 contrib/llvm-project/lld/ELF/SymbolTable.h         |   10 +-
 contrib/llvm-project/lld/ELF/Symbols.cpp           |   11 +-
 contrib/llvm-project/lld/ELF/SyntheticSections.cpp |    2 +-
 contrib/llvm-project/lld/docs/ReleaseNotes.rst     |  150 ++-
 contrib/llvm-project/lld/docs/ld.lld.1             |    3 +
 .../source/Commands/CommandObjectMemoryTag.cpp     |  182 +++-
 .../llvm-project/lldb/source/Commands/Options.td   |    8 +
 .../GDBRemoteCommunicationServerLLGS.cpp           |   28 +-
 .../llvm/include/llvm/Analysis/ValueTracking.h     |    4 +
 .../llvm/include/llvm/CodeGen/TargetLowering.h     |    5 +
 .../llvm/include/llvm/CodeGen/ValueTypes.td        |    1 +
 contrib/llvm-project/llvm/include/llvm/IR/Module.h |    3 +
 .../llvm/include/llvm/ProfileData/InstrProf.h      |    1 +
 .../include/llvm/ProfileData/InstrProfData.inc     |    4 +-
 .../llvm/include/llvm/Support/MachineValueType.h   |    4 +-
 .../llvm/include/llvm/Transforms/IPO/Attributor.h  |   20 +
 .../include/llvm/Transforms/Utils/PredicateInfo.h  |    6 +-
 .../llvm/lib/Analysis/InstructionSimplify.cpp      |   16 +
 .../llvm/lib/Analysis/TargetLibraryInfo.cpp        |    7 +-
 .../llvm/lib/Analysis/ValueTracking.cpp            |   10 +
 .../lib/CodeGen/GlobalISel/InlineAsmLowering.cpp   |    9 +-
 .../llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp  |   10 +-
 .../CodeGen/SelectionDAG/SelectionDAGBuilder.cpp   |    6 +-
 .../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  |    2 +-
 .../lib/CodeGen/SelectionDAG/TargetLowering.cpp    |    3 +-
 .../lib/CodeGen/TargetLoweringObjectFileImpl.cpp   |   11 +-
 .../llvm-project/llvm/lib/CodeGen/ValueTypes.cpp   |    2 +
 contrib/llvm-project/llvm/lib/IR/ConstantFold.cpp  |  241 -----
 contrib/llvm-project/llvm/lib/IR/Module.cpp        |    4 +
 .../llvm/lib/ProfileData/InstrProfReader.cpp       |    2 +-
 .../llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp  |    7 +
 .../lib/Target/AArch64/AArch64ISelLowering.cpp     |   79 +-
 .../llvm/lib/Target/AArch64/AArch64ISelLowering.h  |    7 +
 .../llvm/lib/Target/AArch64/AArch64InstrInfo.cpp   |   34 +-
 .../llvm/lib/Target/AArch64/AArch64InstrInfo.td    |   14 +
 .../llvm/lib/Target/AArch64/AArch64RegisterInfo.td |    4 +-
 .../lib/Target/AArch64/Utils/AArch64BaseInfo.h     |   19 +
 .../llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp   |    2 +-
 .../llvm/lib/Target/BPF/BPFTargetTransformInfo.h   |   18 +
 .../lib/Target/PowerPC/PPCTargetTransformInfo.cpp  |    3 +
 .../llvm/lib/Target/RISCV/RISCVISelLowering.cpp    |    7 +
 .../llvm/lib/Target/RISCV/RISCVInstrInfoV.td       | 1003 ++++++++++++++------
 .../llvm/lib/Target/RISCV/RISCVSchedRocket.td      |    3 +
 .../llvm/lib/Target/RISCV/RISCVSchedSiFive7.td     |    3 +
 .../llvm/lib/Target/RISCV/RISCVSchedule.td         |    1 +
 .../llvm/lib/Target/RISCV/RISCVScheduleV.td        |  820 ++++++++++++++++
 .../llvm/lib/Target/X86/X86ISelLowering.cpp        |   14 +-
 .../llvm/lib/Target/X86/X86InstrArithmetic.td      |   28 +-
 .../llvm/lib/Transforms/IPO/Attributor.cpp         |  117 ++-
 .../lib/Transforms/IPO/AttributorAttributes.cpp    |   54 +-
 .../llvm/lib/Transforms/IPO/OpenMPOpt.cpp          |   16 +-
 .../Transforms/InstCombine/InstCombineCompares.cpp |  123 ++-
 .../InstCombine/InstCombineLoadStoreAlloca.cpp     |    8 +-
 .../Transforms/InstCombine/InstCombineSelect.cpp   |    3 +-
 .../llvm/lib/Transforms/Scalar/DivRemPairs.cpp     |    7 +-
 .../lib/Transforms/Scalar/LoopStrengthReduce.cpp   |   24 +-
 .../llvm/lib/Transforms/Scalar/SROA.cpp            |    5 +-
 .../llvm/lib/Transforms/Utils/PredicateInfo.cpp    |   46 +
 .../lib/Transforms/Vectorize/LoopVectorize.cpp     |   46 +
 .../llvm/tools/llvm-mca/Views/TimelineView.cpp     |   15 +-
 .../llvm/utils/TableGen/CodeGenTarget.cpp          |    1 +
 .../openmp/runtime/src/kmp_taskdeps.cpp            |   27 +-
 .../llvm-project/openmp/runtime/src/kmp_taskdeps.h |    3 +-
 .../openmp/runtime/src/kmp_tasking.cpp             |    1 +
 etc/mtree/BSD.include.dist                         |   18 +-
 lib/clang/include/VCSVersion.inc                   |    8 +-
 lib/clang/include/clang/Config/config.h            |    2 +-
 lib/clang/include/llvm/Config/config.h             |    7 +-
 lib/clang/include/llvm/Config/llvm-config.h        |    2 +-
 lib/clang/include/llvm/Support/VCSRevision.h       |    2 +-
 lib/libc++/Makefile                                |  293 +++++-
 lib/libc++/__config_site                           |    2 +
 lib/libc++experimental/Makefile                    |    1 +
 lib/libclang_rt/asan/Makefile                      |    2 +
 lib/libclang_rt/asan_dynamic/Makefile              |    2 +
 lib/libclang_rt/cfi/Makefile                       |    1 +
 lib/libclang_rt/cfi_diag/Makefile                  |    2 +
 lib/libclang_rt/dd/Makefile                        |    1 +
 lib/libclang_rt/msan/Makefile                      |    2 +
 lib/libclang_rt/profile/Makefile                   |    2 +-
 lib/libclang_rt/stats/Makefile                     |    2 +
 lib/libclang_rt/tsan/Makefile                      |    4 +-
 lib/libclang_rt/ubsan_standalone/Makefile          |    2 +
 lib/libclang_rt/xray/Makefile                      |    1 +
 lib/libcompiler_rt/Makefile.inc                    |    3 +
 lib/libomp/kmp_config.h                            |    6 +-
 lib/libomp/kmp_i18n_default.inc                    |   47 +-
 lib/libomp/kmp_i18n_id.inc                         |   59 +-
 lib/libomp/omp-tools.h                             |  201 ++++
 lib/libomp/omp.h                                   |   55 +-
 tools/build/mk/OptionalObsoleteFiles.inc           |  357 ++++---
 157 files changed, 4432 insertions(+), 1503 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 45b9cea167b6..831b169dafca 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -327,6 +327,152 @@ OLD_DIRS+=usr/lib/clang/12.0.1/lib/freebsd
 OLD_DIRS+=usr/lib/clang/12.0.1/lib
 OLD_DIRS+=usr/lib/clang/12.0.1
 
+# 20211113: new libc++ import which bumps version from 12.0.1 to 13.0.0.
+OLD_FILES+=usr/include/c++/v1/__functional_03
+OLD_FILES+=usr/include/c++/v1/__functional_base_03
+OLD_FILES+=usr/include/c++/v1/__memory/base.h
+OLD_FILES+=usr/include/c++/v1/__memory/utilities.h
+OLD_FILES+=usr/include/c++/v1/__sso_allocator
+OLD_FILES+=usr/include/c++/v1/tr1/__availability
+OLD_FILES+=usr/include/c++/v1/tr1/__bit_reference
+OLD_FILES+=usr/include/c++/v1/tr1/__bits
+OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_defaults.h
+OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_fallbacks.h
+OLD_FILES+=usr/include/c++/v1/tr1/__config
+OLD_FILES+=usr/include/c++/v1/tr1/__debug
+OLD_FILES+=usr/include/c++/v1/tr1/__errc
+OLD_FILES+=usr/include/c++/v1/tr1/__functional_03
+OLD_FILES+=usr/include/c++/v1/tr1/__functional_base
+OLD_FILES+=usr/include/c++/v1/tr1/__functional_base_03
+OLD_FILES+=usr/include/c++/v1/tr1/__hash_table
+OLD_FILES+=usr/include/c++/v1/tr1/__libcpp_version
+OLD_FILES+=usr/include/c++/v1/tr1/__locale
+OLD_FILES+=usr/include/c++/v1/tr1/__mutex_base
+OLD_FILES+=usr/include/c++/v1/tr1/__node_handle
+OLD_FILES+=usr/include/c++/v1/tr1/__nullptr
+OLD_FILES+=usr/include/c++/v1/tr1/__split_buffer
+OLD_FILES+=usr/include/c++/v1/tr1/__sso_allocator
+OLD_FILES+=usr/include/c++/v1/tr1/__std_stream
+OLD_FILES+=usr/include/c++/v1/tr1/__string
+OLD_FILES+=usr/include/c++/v1/tr1/__threading_support
+OLD_FILES+=usr/include/c++/v1/tr1/__tree
+OLD_FILES+=usr/include/c++/v1/tr1/__tuple
+OLD_FILES+=usr/include/c++/v1/tr1/__undef_macros
+OLD_FILES+=usr/include/c++/v1/tr1/algorithm
+OLD_FILES+=usr/include/c++/v1/tr1/any
+OLD_FILES+=usr/include/c++/v1/tr1/array
+OLD_FILES+=usr/include/c++/v1/tr1/atomic
+OLD_FILES+=usr/include/c++/v1/tr1/barrier
+OLD_FILES+=usr/include/c++/v1/tr1/bit
+OLD_FILES+=usr/include/c++/v1/tr1/bitset
+OLD_FILES+=usr/include/c++/v1/tr1/cassert
+OLD_FILES+=usr/include/c++/v1/tr1/ccomplex
+OLD_FILES+=usr/include/c++/v1/tr1/cctype
+OLD_FILES+=usr/include/c++/v1/tr1/cerrno
+OLD_FILES+=usr/include/c++/v1/tr1/cfenv
+OLD_FILES+=usr/include/c++/v1/tr1/cfloat
+OLD_FILES+=usr/include/c++/v1/tr1/charconv
+OLD_FILES+=usr/include/c++/v1/tr1/chrono
+OLD_FILES+=usr/include/c++/v1/tr1/cinttypes
+OLD_FILES+=usr/include/c++/v1/tr1/ciso646
+OLD_FILES+=usr/include/c++/v1/tr1/climits
+OLD_FILES+=usr/include/c++/v1/tr1/clocale
+OLD_FILES+=usr/include/c++/v1/tr1/cmath
+OLD_FILES+=usr/include/c++/v1/tr1/codecvt
+OLD_FILES+=usr/include/c++/v1/tr1/compare
+OLD_FILES+=usr/include/c++/v1/tr1/complex
+OLD_FILES+=usr/include/c++/v1/tr1/complex.h
+OLD_FILES+=usr/include/c++/v1/tr1/concepts
+OLD_FILES+=usr/include/c++/v1/tr1/condition_variable
+OLD_FILES+=usr/include/c++/v1/tr1/csetjmp
+OLD_FILES+=usr/include/c++/v1/tr1/csignal
+OLD_FILES+=usr/include/c++/v1/tr1/cstdarg
+OLD_FILES+=usr/include/c++/v1/tr1/cstdbool
+OLD_FILES+=usr/include/c++/v1/tr1/cstddef
+OLD_FILES+=usr/include/c++/v1/tr1/cstdint
+OLD_FILES+=usr/include/c++/v1/tr1/cstdio
+OLD_FILES+=usr/include/c++/v1/tr1/cstdlib
+OLD_FILES+=usr/include/c++/v1/tr1/cstring
+OLD_FILES+=usr/include/c++/v1/tr1/ctgmath
+OLD_FILES+=usr/include/c++/v1/tr1/ctime
+OLD_FILES+=usr/include/c++/v1/tr1/ctype.h
+OLD_FILES+=usr/include/c++/v1/tr1/cwchar
+OLD_FILES+=usr/include/c++/v1/tr1/cwctype
+OLD_FILES+=usr/include/c++/v1/tr1/deque
+OLD_FILES+=usr/include/c++/v1/tr1/errno.h
+OLD_FILES+=usr/include/c++/v1/tr1/exception
+OLD_FILES+=usr/include/c++/v1/tr1/execution
+OLD_FILES+=usr/include/c++/v1/tr1/fenv.h
+OLD_FILES+=usr/include/c++/v1/tr1/filesystem
+OLD_FILES+=usr/include/c++/v1/tr1/float.h
+OLD_FILES+=usr/include/c++/v1/tr1/forward_list
+OLD_FILES+=usr/include/c++/v1/tr1/fstream
+OLD_FILES+=usr/include/c++/v1/tr1/functional
+OLD_FILES+=usr/include/c++/v1/tr1/future
+OLD_FILES+=usr/include/c++/v1/tr1/initializer_list
+OLD_FILES+=usr/include/c++/v1/tr1/inttypes.h
+OLD_FILES+=usr/include/c++/v1/tr1/iomanip
+OLD_FILES+=usr/include/c++/v1/tr1/ios
+OLD_FILES+=usr/include/c++/v1/tr1/iosfwd
+OLD_FILES+=usr/include/c++/v1/tr1/iostream
+OLD_FILES+=usr/include/c++/v1/tr1/istream
+OLD_FILES+=usr/include/c++/v1/tr1/iterator
+OLD_FILES+=usr/include/c++/v1/tr1/latch
+OLD_FILES+=usr/include/c++/v1/tr1/limits
+OLD_FILES+=usr/include/c++/v1/tr1/limits.h
+OLD_FILES+=usr/include/c++/v1/tr1/list
+OLD_FILES+=usr/include/c++/v1/tr1/locale
+OLD_FILES+=usr/include/c++/v1/tr1/locale.h
+OLD_FILES+=usr/include/c++/v1/tr1/map
+OLD_FILES+=usr/include/c++/v1/tr1/math.h
+OLD_FILES+=usr/include/c++/v1/tr1/memory
+OLD_FILES+=usr/include/c++/v1/tr1/mutex
+OLD_FILES+=usr/include/c++/v1/tr1/new
+OLD_FILES+=usr/include/c++/v1/tr1/numbers
+OLD_FILES+=usr/include/c++/v1/tr1/numeric
+OLD_FILES+=usr/include/c++/v1/tr1/optional
+OLD_FILES+=usr/include/c++/v1/tr1/ostream
+OLD_FILES+=usr/include/c++/v1/tr1/queue
+OLD_FILES+=usr/include/c++/v1/tr1/random
+OLD_FILES+=usr/include/c++/v1/tr1/ratio
+OLD_FILES+=usr/include/c++/v1/tr1/regex
+OLD_FILES+=usr/include/c++/v1/tr1/scoped_allocator
+OLD_FILES+=usr/include/c++/v1/tr1/semaphore
+OLD_FILES+=usr/include/c++/v1/tr1/set
+OLD_FILES+=usr/include/c++/v1/tr1/setjmp.h
+OLD_FILES+=usr/include/c++/v1/tr1/shared_mutex
+OLD_FILES+=usr/include/c++/v1/tr1/span
+OLD_FILES+=usr/include/c++/v1/tr1/sstream
+OLD_FILES+=usr/include/c++/v1/tr1/stack
+OLD_FILES+=usr/include/c++/v1/tr1/stdbool.h
+OLD_FILES+=usr/include/c++/v1/tr1/stddef.h
+OLD_FILES+=usr/include/c++/v1/tr1/stdexcept
+OLD_FILES+=usr/include/c++/v1/tr1/stdint.h
+OLD_FILES+=usr/include/c++/v1/tr1/stdio.h
+OLD_FILES+=usr/include/c++/v1/tr1/stdlib.h
+OLD_FILES+=usr/include/c++/v1/tr1/streambuf
+OLD_FILES+=usr/include/c++/v1/tr1/string
+OLD_FILES+=usr/include/c++/v1/tr1/string.h
+OLD_FILES+=usr/include/c++/v1/tr1/string_view
+OLD_FILES+=usr/include/c++/v1/tr1/strstream
+OLD_FILES+=usr/include/c++/v1/tr1/system_error
+OLD_FILES+=usr/include/c++/v1/tr1/tgmath.h
+OLD_FILES+=usr/include/c++/v1/tr1/thread
+OLD_FILES+=usr/include/c++/v1/tr1/tuple
+OLD_FILES+=usr/include/c++/v1/tr1/type_traits
+OLD_FILES+=usr/include/c++/v1/tr1/typeindex
+OLD_FILES+=usr/include/c++/v1/tr1/typeinfo
+OLD_FILES+=usr/include/c++/v1/tr1/unordered_map
+OLD_FILES+=usr/include/c++/v1/tr1/unordered_set
+OLD_FILES+=usr/include/c++/v1/tr1/utility
+OLD_FILES+=usr/include/c++/v1/tr1/valarray
+OLD_FILES+=usr/include/c++/v1/tr1/variant
+OLD_FILES+=usr/include/c++/v1/tr1/vector
+OLD_FILES+=usr/include/c++/v1/tr1/version
+OLD_FILES+=usr/include/c++/v1/tr1/wchar.h
+OLD_FILES+=usr/include/c++/v1/tr1/wctype.h
+OLD_DIRS+=usr/include/c++/v1/tr1
+
 # 20210906: stop installing {llvm,clang,lldb}-tblgen
 OLD_FILES+=usr/bin/llvm-tblgen
 OLD_FILES+=usr/bin/clang-tblgen
diff --git a/contrib/llvm-project/clang/include/clang/Basic/BuiltinsAArch64.def b/contrib/llvm-project/clang/include/clang/Basic/BuiltinsAArch64.def
index 1dac5d2371d4..634bcaed20a6 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/BuiltinsAArch64.def
+++ b/contrib/llvm-project/clang/include/clang/Basic/BuiltinsAArch64.def
@@ -243,6 +243,9 @@ TARGET_HEADER_BUILTIN(_ReadStatusReg,  "LLii",  "nh", "intrin.h", ALL_MS_LANGUAG
 TARGET_HEADER_BUILTIN(_WriteStatusReg, "viLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_AddressOfReturnAddress, "v*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(__mulh,  "SLLiSLLiSLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(__umulh, "ULLiULLiULLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+
 #undef BUILTIN
 #undef LANGBUILTIN
 #undef TARGET_HEADER_BUILTIN
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticDriverKinds.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 3b4daa59f66b..fc3704303a95 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -129,8 +129,6 @@ def err_drv_invalid_Xopenmp_target_with_args : Error<
   "invalid -Xopenmp-target argument: '%0', options requiring arguments are unsupported">;
 def err_drv_argument_only_allowed_with : Error<
   "invalid argument '%0' only allowed with '%1'">;
-def err_drv_minws_unsupported_input_type : Error<
-  "'-fminimize-whitespace' invalid for input of type %0">;
 def err_drv_amdgpu_ieee_without_no_honor_nans : Error<
   "invalid argument '-mno-amdgpu-ieee' only allowed with relaxed NaN handling">;
 def err_drv_argument_not_allowed_with : Error<
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td
index ce6d0d0394b4..bdf5d263fa92 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -300,6 +300,13 @@ def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">,
 def pp_pragma_sysheader_in_main_file : Warning<
   "#pragma system_header ignored in main file">,
   InGroup<DiagGroup<"pragma-system-header-outside-header">>;
+
+def err_pragma_include_instead_not_sysheader : Error<
+  "'#pragma clang include_instead' cannot be used outside of system headers">;
+def err_pragma_include_instead_system_reserved : Error<
+  "header '%0' is an implementation detail; #include %select{'%2'|either '%2' "
+  "or '%3'|one of %2}1 instead">;
+
 def pp_poisoning_existing_macro : Warning<"poisoning existing macro">;
 def pp_out_of_date_dependency : Warning<
   "current file is older than dependency %0">;
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 108f1796415c..c57b8eca7deb 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10100,8 +10100,6 @@ def err_opencl_requires_extension : Error<
 def ext_opencl_double_without_pragma : Extension<
   "Clang permits use of type 'double' regardless pragma if 'cl_khr_fp64' is"
   " supported">;
-def err_opencl_double_requires_extension :  Error<
-    "use of type 'double' requires %select{cl_khr_fp64|cl_khr_fp64 and __opencl_c_fp64}0 support">;
 def warn_opencl_generic_address_space_arg : Warning<
   "passing non-generic address space pointer to %0"
   " may cause dynamic conversion affecting performance">,
diff --git a/contrib/llvm-project/clang/include/clang/Basic/LangOptions.def b/contrib/llvm-project/clang/include/clang/Basic/LangOptions.def
index 08b8d8851afa..74deba6ef7fb 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/LangOptions.def
+++ b/contrib/llvm-project/clang/include/clang/Basic/LangOptions.def
@@ -224,7 +224,7 @@ LANGOPT(OpenCLVersion     , 32, 0, "OpenCL C version")
 LANGOPT(OpenCLCPlusPlus   , 1, 0, "C++ for OpenCL")
 LANGOPT(OpenCLCPlusPlusVersion     , 32, 0, "C++ for OpenCL version")
 LANGOPT(OpenCLGenericAddressSpace, 1, 0, "OpenCL generic keyword")
-LANGOPT(OpenCLPipe               , 1, 0, "OpenCL pipe keyword")
+LANGOPT(OpenCLPipes              , 1, 0, "OpenCL pipes language constructs and built-ins")
 LANGOPT(NativeHalfType    , 1, 0, "Native half type support")
 LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
 LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
diff --git a/contrib/llvm-project/clang/include/clang/Basic/LangOptions.h b/contrib/llvm-project/clang/include/clang/Basic/LangOptions.h
index 71cf0c65e692..b60b94a1ba08 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/LangOptions.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/LangOptions.h
@@ -354,6 +354,9 @@ public:
   /// A list of all -fno-builtin-* function names (e.g., memset).
   std::vector<std::string> NoBuiltinFuncs;
 
+  /// A prefix map for __FILE__, __BASE_FILE__ and __builtin_FILE().
+  std::map<std::string, std::string, std::greater<std::string>> MacroPrefixMap;
+
   /// Triples of the OpenMP targets that the host code codegen should
   /// take into account in order to generate accurate offloading descriptors.
   std::vector<llvm::Triple> OMPTargetTriples;
@@ -460,6 +463,9 @@ public:
   }
 
   bool isSYCL() const { return SYCLIsDevice || SYCLIsHost; }
+
+  /// Remap path prefix according to -fmacro-prefix-path option.
+  void remapPathPrefix(SmallString<256> &Path) const;
 };
 
 /// Floating point control options
diff --git a/contrib/llvm-project/clang/include/clang/Driver/Options.td b/contrib/llvm-project/clang/include/clang/Driver/Options.td
index 5a9fd078390e..a0cbcae0bdc3 100644
--- a/contrib/llvm-project/clang/include/clang/Driver/Options.td
+++ b/contrib/llvm-project/clang/include/clang/Driver/Options.td
@@ -1799,9 +1799,6 @@ def frewrite_map_file_EQ : Joined<["-"], "frewrite-map-file=">,
 defm use_line_directives : BoolFOption<"use-line-directives",
   PreprocessorOutputOpts<"UseLineDirectives">, DefaultFalse,
   PosFlag<SetTrue, [CC1Option], "Use #line in preprocessed output">, NegFlag<SetFalse>>;
-defm minimize_whitespace : BoolFOption<"minimize-whitespace",
-  PreprocessorOutputOpts<"MinimizeWhitespace">, DefaultFalse,
-  PosFlag<SetTrue, [CC1Option], "Minimize whitespace when emitting preprocessor output">, NegFlag<SetFalse>>;
 
 def ffreestanding : Flag<["-"], "ffreestanding">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Assert that the compilation takes place in a freestanding environment">,
@@ -2828,10 +2825,10 @@ def fcoverage_prefix_map_EQ
     HelpText<"remap file source paths in coverage mapping">;
 def ffile_prefix_map_EQ
   : Joined<["-"], "ffile-prefix-map=">, Group<f_Group>,
-    HelpText<"remap file source paths in debug info and predefined preprocessor macros">;
+    HelpText<"remap file source paths in debug info, predefined preprocessor macros and __builtin_FILE()">;
 def fmacro_prefix_map_EQ
-  : Joined<["-"], "fmacro-prefix-map=">, Group<Preprocessor_Group>, Flags<[CC1Option]>,
-    HelpText<"remap file source paths in predefined preprocessor macros">;
+  : Joined<["-"], "fmacro-prefix-map=">, Group<f_Group>, Flags<[CC1Option]>,
+    HelpText<"remap file source paths in predefined preprocessor macros and __builtin_FILE()">;
 defm force_dwarf_frame : BoolFOption<"force-dwarf-frame",
   CodeGenOpts<"ForceDwarfFrameSection">, DefaultFalse,
   PosFlag<SetTrue, [CC1Option], "Always emit a debug frame section">, NegFlag<SetFalse>>;
diff --git a/contrib/llvm-project/clang/include/clang/Driver/Types.h b/contrib/llvm-project/clang/include/clang/Driver/Types.h
index c9d63551090c..6a1f57416ae5 100644
--- a/contrib/llvm-project/clang/include/clang/Driver/Types.h
+++ b/contrib/llvm-project/clang/include/clang/Driver/Types.h
@@ -66,14 +66,6 @@ namespace types {
   /// isAcceptedByClang - Can clang handle this input type.
   bool isAcceptedByClang(ID Id);
 
-  /// isDerivedFromC - Is the input derived from C.
-  ///
-  /// That is, does the lexer follow the rules of
-  /// TokenConcatenation::AvoidConcat. If this is the case, the preprocessor may
-  /// add and remove whitespace between tokens. Used to determine whether the
-  /// input can be processed by -fminimize-whitespace.
-  bool isDerivedFromC(ID Id);
-
   /// isCXX - Is this a "C++" input (C++ and Obj-C++ sources and headers).
   bool isCXX(ID Id);
 
diff --git a/contrib/llvm-project/clang/include/clang/Frontend/PreprocessorOutputOptions.h b/contrib/llvm-project/clang/include/clang/Frontend/PreprocessorOutputOptions.h
index 257538ee0606..72e5ad1137fb 100644
--- a/contrib/llvm-project/clang/include/clang/Frontend/PreprocessorOutputOptions.h
+++ b/contrib/llvm-project/clang/include/clang/Frontend/PreprocessorOutputOptions.h
@@ -24,7 +24,6 @@ public:
   unsigned ShowIncludeDirectives : 1;  ///< Print includes, imports etc. within preprocessed output.
   unsigned RewriteIncludes : 1;    ///< Preprocess include directives only.
   unsigned RewriteImports  : 1;    ///< Include contents of transitively-imported modules.
-  unsigned MinimizeWhitespace : 1; ///< Ignore whitespace from input.
 
 public:
   PreprocessorOutputOptions() {
@@ -37,7 +36,6 @@ public:
     ShowIncludeDirectives = 0;
     RewriteIncludes = 0;
     RewriteImports = 0;
-    MinimizeWhitespace = 0;
   }
 };
 
diff --git a/contrib/llvm-project/clang/include/clang/Lex/HeaderSearch.h b/contrib/llvm-project/clang/include/clang/Lex/HeaderSearch.h
index 93d6ea72270a..a35a394f719b 100644
--- a/contrib/llvm-project/clang/include/clang/Lex/HeaderSearch.h
+++ b/contrib/llvm-project/clang/include/clang/Lex/HeaderSearch.h
@@ -20,9 +20,12 @@
 #include "clang/Lex/ModuleMap.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/Support/Allocator.h"
 #include <cassert>
 #include <cstddef>
@@ -110,6 +113,14 @@ struct HeaderFileInfo {
   /// of the framework.
   StringRef Framework;
 
+  /// List of aliases that this header is known as.
+  /// Most headers should only have at most one alias, but a handful
+  /// have two.
+  llvm::SetVector<llvm::SmallString<32>,
+                  llvm::SmallVector<llvm::SmallString<32>, 2>,
+                  llvm::SmallSet<llvm::SmallString<32>, 2>>
+      Aliases;
+
   HeaderFileInfo()
       : isImport(false), isPragmaOnce(false), DirInfo(SrcMgr::C_User),
         External(false), isModuleHeader(false), isCompilingModuleHeader(false),
@@ -453,6 +464,10 @@ public:
     getFileInfo(File).DirInfo = SrcMgr::C_System;
   }
 
+  void AddFileAlias(const FileEntry *File, StringRef Alias) {
+    getFileInfo(File).Aliases.insert(Alias);
+  }
+
   /// Mark the specified file as part of a module.
   void MarkFileModuleHeader(const FileEntry *FE,
                             ModuleMap::ModuleHeaderRole Role,
diff --git a/contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h b/contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h
index 7ab13640ce2c..fe2327f0a480 100644
--- a/contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h
+++ b/contrib/llvm-project/clang/include/clang/Lex/Preprocessor.h
@@ -1953,7 +1953,8 @@ public:
   /// This either returns the EOF token and returns true, or
   /// pops a level off the include stack and returns false, at which point the
   /// client should call lex again.
-  bool HandleEndOfFile(Token &Result, bool isEndOfMacro = false);
+  bool HandleEndOfFile(Token &Result, SourceLocation Loc,
+                       bool isEndOfMacro = false);
 
   /// Callback invoked when the current TokenLexer hits the end of its
   /// token stream.
@@ -2363,12 +2364,14 @@ private:
 
   // Pragmas.
   void HandlePragmaDirective(PragmaIntroducer Introducer);
+  void ResolvePragmaIncludeInstead(SourceLocation Location) const;
 
 public:
   void HandlePragmaOnce(Token &OnceTok);
   void HandlePragmaMark(Token &MarkTok);
   void HandlePragmaPoison();
   void HandlePragmaSystemHeader(Token &SysHeaderTok);
+  void HandlePragmaIncludeInstead(Token &Tok);
   void HandlePragmaDependency(Token &DependencyTok);
   void HandlePragmaPushMacro(Token &Tok);
   void HandlePragmaPopMacro(Token &Tok);
diff --git a/contrib/llvm-project/clang/include/clang/Lex/PreprocessorLexer.h b/contrib/llvm-project/clang/include/clang/Lex/PreprocessorLexer.h
index 03b1cc2c10e2..b43197a6031c 100644
--- a/contrib/llvm-project/clang/include/clang/Lex/PreprocessorLexer.h
+++ b/contrib/llvm-project/clang/include/clang/Lex/PreprocessorLexer.h
@@ -14,11 +14,13 @@
 #ifndef LLVM_CLANG_LEX_PREPROCESSORLEXER_H
 #define LLVM_CLANG_LEX_PREPROCESSORLEXER_H
 
+#include "clang/Basic/SourceLocation.h"
+#include "clang/Lex/HeaderSearch.h"
 #include "clang/Lex/MultipleIncludeOpt.h"
 #include "clang/Lex/Token.h"
-#include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
 #include <cassert>
 
 namespace clang {
@@ -74,6 +76,13 @@ protected:
   /// we are currently in.
   SmallVector<PPConditionalInfo, 4> ConditionalStack;
 
+  struct IncludeInfo {
+    const FileEntry *File;
+    SourceLocation Location;
+  };
+  // A complete history of all the files included by the current file.
+  llvm::StringMap<IncludeInfo> IncludeHistory;
+
   PreprocessorLexer() : FID() {}
   PreprocessorLexer(Preprocessor *pp, FileID fid);
   virtual ~PreprocessorLexer() = default;
@@ -175,6 +184,15 @@ public:
     ConditionalStack.clear();
     ConditionalStack.append(CL.begin(), CL.end());
   }
+
+  void addInclude(StringRef Filename, const FileEntry &File,
+                  SourceLocation Location) {
+    IncludeHistory.insert({Filename, {&File, Location}});
+  }
+
+  const llvm::StringMap<IncludeInfo> &getIncludeHistory() const {
+    return IncludeHistory;
+  }
 };
 
 } // namespace clang
diff --git a/contrib/llvm-project/clang/include/clang/Lex/PreprocessorOptions.h b/contrib/llvm-project/clang/include/clang/Lex/PreprocessorOptions.h
index 99085b98fc7a..a7aabc3e1df2 100644
--- a/contrib/llvm-project/clang/include/clang/Lex/PreprocessorOptions.h
+++ b/contrib/llvm-project/clang/include/clang/Lex/PreprocessorOptions.h
@@ -199,9 +199,6 @@ public:
   /// build it again.
   std::shared_ptr<FailedModulesSet> FailedModules;
 
-  /// A prefix map for __FILE__ and __BASE_FILE__.
-  std::map<std::string, std::string, std::greater<std::string>> MacroPrefixMap;
-
   /// Contains the currently active skipped range mappings for skipping excluded
   /// conditional directives.
   ///
diff --git a/contrib/llvm-project/clang/include/clang/Sema/Sema.h b/contrib/llvm-project/clang/include/clang/Sema/Sema.h
index 83a2d132bf6a..d8b2546b81a3 100644
--- a/contrib/llvm-project/clang/include/clang/Sema/Sema.h
+++ b/contrib/llvm-project/clang/include/clang/Sema/Sema.h
@@ -7828,8 +7828,7 @@ public:
                                  TemplateArgumentLoc &Arg,
                            SmallVectorImpl<TemplateArgument> &Converted);
 
-  bool CheckTemplateArgument(TemplateTypeParmDecl *Param,
-                             TypeSourceInfo *Arg);
+  bool CheckTemplateArgument(TypeSourceInfo *Arg);
   ExprResult CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
                                    QualType InstantiatedParamType, Expr *Arg,
                                    TemplateArgument &Converted,
diff --git a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
index e102a3ba508d..fdba204fbe7f 100644
--- a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp
@@ -6066,9 +6066,11 @@ ASTContext::getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const {
                                     NNS->getAsNamespaceAlias()->getNamespace()
                                                       ->getOriginalNamespace());
 
+  // The difference between TypeSpec and TypeSpecWithTemplate is that the
+  // latter will have the 'template' keyword when printed.
   case NestedNameSpecifier::TypeSpec:
   case NestedNameSpecifier::TypeSpecWithTemplate: {
-    QualType T = getCanonicalType(QualType(NNS->getAsType(), 0));
+    const Type *T = getCanonicalType(NNS->getAsType());
 
     // If we have some kind of dependent-named type (e.g., "typename T::type"),
     // break it apart into its prefix and identifier, then reconsititute those
@@ -6078,14 +6080,16 @@ ASTContext::getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const {
     //   typedef typename T::type T1;
     //   typedef typename T1::type T2;
     if (const auto *DNT = T->getAs<DependentNameType>())
-      return NestedNameSpecifier::Create(*this, DNT->getQualifier(),
-                           const_cast<IdentifierInfo *>(DNT->getIdentifier()));
-
-    // Otherwise, just canonicalize the type, and force it to be a TypeSpec.
-    // FIXME: Why are TypeSpec and TypeSpecWithTemplate distinct in the
-    // first place?
+      return NestedNameSpecifier::Create(
+          *this, DNT->getQualifier(),
+          const_cast<IdentifierInfo *>(DNT->getIdentifier()));
+    if (const auto *DTST = T->getAs<DependentTemplateSpecializationType>())
+      return NestedNameSpecifier::Create(*this, DTST->getQualifier(), true,
+                                         const_cast<Type *>(T));
+
+    // TODO: Set 'Template' parameter to true for other template types.
     return NestedNameSpecifier::Create(*this, nullptr, false,
-                                       const_cast<Type *>(T.getTypePtr()));
+                                       const_cast<Type *>(T));
   }
 
   case NestedNameSpecifier::Global:
diff --git a/contrib/llvm-project/clang/lib/AST/Expr.cpp b/contrib/llvm-project/clang/lib/AST/Expr.cpp
index e8b4aaa2b81e..11f10d4695fc 100644
--- a/contrib/llvm-project/clang/lib/AST/Expr.cpp
+++ b/contrib/llvm-project/clang/lib/AST/Expr.cpp
@@ -2233,8 +2233,11 @@ APValue SourceLocExpr::EvaluateInContext(const ASTContext &Ctx,
   };
 
   switch (getIdentKind()) {
-  case SourceLocExpr::File:
-    return MakeStringLiteral(PLoc.getFilename());
+  case SourceLocExpr::File: {
+    SmallString<256> Path(PLoc.getFilename());
+    Ctx.getLangOpts().remapPathPrefix(Path);
+    return MakeStringLiteral(Path);
+  }
   case SourceLocExpr::Function: {
     const Decl *CurDecl = dyn_cast_or_null<Decl>(Context);
     return MakeStringLiteral(
diff --git a/contrib/llvm-project/clang/lib/Basic/LangOptions.cpp b/contrib/llvm-project/clang/lib/Basic/LangOptions.cpp
index dc392d5352aa..bebf3178426f 100644
--- a/contrib/llvm-project/clang/lib/Basic/LangOptions.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/LangOptions.cpp
@@ -11,6 +11,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Basic/LangOptions.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Path.h"
 
 using namespace clang;
 
@@ -48,6 +50,12 @@ VersionTuple LangOptions::getOpenCLVersionTuple() const {
   return VersionTuple(Ver / 100, (Ver % 100) / 10);
 }
 
+void LangOptions::remapPathPrefix(SmallString<256> &Path) const {
+  for (const auto &Entry : MacroPrefixMap)
+    if (llvm::sys::path::replace_path_prefix(Path, Entry.first, Entry.second))
+      break;
+}
+
 FPOptions FPOptions::defaultWithoutTrailingStorage(const LangOptions &LO) {
   FPOptions result(LO);
   return result;
diff --git a/contrib/llvm-project/clang/lib/Basic/OpenCLOptions.cpp b/contrib/llvm-project/clang/lib/Basic/OpenCLOptions.cpp
index 2e215b185f66..b7408f39bdab 100644
--- a/contrib/llvm-project/clang/lib/Basic/OpenCLOptions.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/OpenCLOptions.cpp
@@ -111,7 +111,9 @@ bool OpenCLOptions::diagnoseUnsupportedFeatureDependencies(
   // Feature pairs. First feature in a pair requires the second one to be
   // supported.
   static const llvm::StringMap<llvm::StringRef> DependentFeaturesMap = {
-      {"__opencl_c_read_write_images", "__opencl_c_images"}};
+      {"__opencl_c_read_write_images", "__opencl_c_images"},
+      {"__opencl_c_3d_image_writes", "__opencl_c_images"},
+      {"__opencl_c_pipes", "__opencl_c_generic_address_space"}};
 
   auto OpenCLFeaturesMap = TI.getSupportedOpenCLOpts();
 
@@ -130,7 +132,8 @@ bool OpenCLOptions::diagnoseFeatureExtensionDifferences(
     const TargetInfo &TI, DiagnosticsEngine &Diags) {
   // Extensions and equivalent feature pairs.
   static const llvm::StringMap<llvm::StringRef> FeatureExtensionMap = {
-      {"cl_khr_fp64", "__opencl_c_fp64"}};
+      {"cl_khr_fp64", "__opencl_c_fp64"},
+      {"cl_khr_3d_image_writes", "__opencl_c_3d_image_writes"}};
 
   auto OpenCLFeaturesMap = TI.getSupportedOpenCLOpts();
 
diff --git a/contrib/llvm-project/clang/lib/Basic/TargetInfo.cpp b/contrib/llvm-project/clang/lib/Basic/TargetInfo.cpp
index b647a2fb8a67..5f8e04c2bd6c 100644
--- a/contrib/llvm-project/clang/lib/Basic/TargetInfo.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/TargetInfo.cpp
@@ -400,14 +400,18 @@ void TargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
     // OpenCL C v3.0 s6.7.5 - The generic address space requires support for
     // OpenCL C 2.0 or OpenCL C 3.0 with the __opencl_c_generic_address_space
     // feature
-    // FIXME: OpenCLGenericAddressSpace is also defined in setLangDefaults()
+    // OpenCL C v3.0 s6.2.1 - OpenCL pipes require support of OpenCL C 2.0
+    // or later and __opencl_c_pipes feature
+    // FIXME: These language options are also defined in setLangDefaults()
     // for OpenCL C 2.0 but with no access to target capabilities. Target
-    // should be immutable once created and thus this language option needs
+    // should be immutable once created and thus these language options need
     // to be defined only once.
-    if (Opts.OpenCLVersion >= 300) {
+    if (Opts.OpenCLVersion == 300) {
       const auto &OpenCLFeaturesMap = getSupportedOpenCLOpts();
       Opts.OpenCLGenericAddressSpace = hasFeatureEnabled(
           OpenCLFeaturesMap, "__opencl_c_generic_address_space");
+      Opts.OpenCLPipes =
+          hasFeatureEnabled(OpenCLFeaturesMap, "__opencl_c_pipes");
     }
   }
 
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp b/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
index 4070ac727d16..e163ebfa2348 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/AArch64.cpp
@@ -431,7 +431,8 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
            Feature == "sve2-aes" || Feature == "sve2-sha3" ||
            Feature == "sve2-sm4" || Feature == "f64mm" || Feature == "f32mm" ||
            Feature == "i8mm" || Feature == "bf16") &&
-          (FPU & SveMode));
+          (FPU & SveMode)) ||
+         (Feature == "ls64" && HasLS64);
 }
 
 bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
@@ -752,6 +753,9 @@ bool AArch64TargetInfo::validateConstraintModifier(
       if (Size == 64)
         return true;
 
+      if (Size == 512)
+        return HasLS64;
+
       SuggestedModifier = "w";
       return false;
     }
diff --git a/contrib/llvm-project/clang/lib/Basic/Targets/AMDGPU.h b/contrib/llvm-project/clang/lib/Basic/Targets/AMDGPU.h
index 244a6e044690..2e580ecf2425 100644
--- a/contrib/llvm-project/clang/lib/Basic/Targets/AMDGPU.h
+++ b/contrib/llvm-project/clang/lib/Basic/Targets/AMDGPU.h
@@ -310,9 +310,12 @@ public:
       Opts["cl_khr_mipmap_image"] = true;
       Opts["cl_khr_mipmap_image_writes"] = true;
       Opts["cl_khr_subgroups"] = true;
-      Opts["cl_khr_3d_image_writes"] = true;
       Opts["cl_amd_media_ops"] = true;
       Opts["cl_amd_media_ops2"] = true;
+
+      Opts["__opencl_c_images"] = true;
+      Opts["__opencl_c_3d_image_writes"] = true;
+      Opts["cl_khr_3d_image_writes"] = true;
     }
   }
 
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp
index d9b2a5fe16be..1a02965b223e 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp
@@ -9732,6 +9732,29 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
     return Builder.CreateCall(F);
   }
 
+  if (BuiltinID == AArch64::BI__mulh || BuiltinID == AArch64::BI__umulh) {
+    llvm::Type *ResType = ConvertType(E->getType());
+    llvm::Type *Int128Ty = llvm::IntegerType::get(getLLVMContext(), 128);
+
+    bool IsSigned = BuiltinID == AArch64::BI__mulh;
+    Value *LHS =
+        Builder.CreateIntCast(EmitScalarExpr(E->getArg(0)), Int128Ty, IsSigned);
+    Value *RHS =
+        Builder.CreateIntCast(EmitScalarExpr(E->getArg(1)), Int128Ty, IsSigned);
+
+    Value *MulResult, *HigherBits;
+    if (IsSigned) {
+      MulResult = Builder.CreateNSWMul(LHS, RHS);
+      HigherBits = Builder.CreateAShr(MulResult, 64);
+    } else {
+      MulResult = Builder.CreateNUWMul(LHS, RHS);
+      HigherBits = Builder.CreateLShr(MulResult, 64);
+    }
+    HigherBits = Builder.CreateIntCast(HigherBits, ResType, IsSigned);
+
+    return HigherBits;
+  }
+
   // Handle MSVC intrinsics before argument evaluation to prevent double
   // evaluation.
   if (Optional<MSVCIntrin> MsvcIntId = translateAarch64ToMsvcIntrin(BuiltinID))
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGDeclCXX.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGDeclCXX.cpp
index d43fb99550a8..553fedebfe56 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -555,7 +555,8 @@ CodeGenModule::EmitCXXGlobalVarDeclInitFunc(const VarDecl *D,
                                           PrioritizedCXXGlobalInits.size());
     PrioritizedCXXGlobalInits.push_back(std::make_pair(Key, Fn));
   } else if (isTemplateInstantiation(D->getTemplateSpecializationKind()) ||
-             getContext().GetGVALinkageForVariable(D) == GVA_DiscardableODR) {
+             getContext().GetGVALinkageForVariable(D) == GVA_DiscardableODR ||
+             D->hasAttr<SelectAnyAttr>()) {
     // C++ [basic.start.init]p2:
     //   Definitions of explicitly specialized class template static data
     //   members have ordered initialization. Other class template static data
@@ -568,17 +569,18 @@ CodeGenModule::EmitCXXGlobalVarDeclInitFunc(const VarDecl *D,
     // group with the global being initialized.  On most platforms, this is a
     // minor startup time optimization.  In the MS C++ ABI, there are no guard
     // variables, so this COMDAT key is required for correctness.
-    AddGlobalCtor(Fn, 65535, COMDATKey);
-    if (getTarget().getCXXABI().isMicrosoft() && COMDATKey) {
-      // In The MS C++, MS add template static data member in the linker
-      // drective.
-      addUsedGlobal(COMDATKey);
-    }
-  } else if (D->hasAttr<SelectAnyAttr>()) {
+    //
     // SelectAny globals will be comdat-folded. Put the initializer into a
     // COMDAT group associated with the global, so the initializers get folded
     // too.
+
     AddGlobalCtor(Fn, 65535, COMDATKey);
+    if (COMDATKey && (getTriple().isOSBinFormatELF() ||
+                      getTarget().getCXXABI().isMicrosoft())) {
+      // When COMDAT is used on ELF or in the MS C++ ABI, the key must be in
+      // llvm.used to prevent linker GC.
+      addUsedGlobal(COMDATKey);
+    }
   } else {
     I = DelayedCXXInitPosition.find(D); // Re-do lookup in case of re-hash.
     if (I == DelayedCXXInitPosition.end()) {
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp
index aeb319ca1581..0a3a722fa653 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGStmt.cpp
@@ -2097,7 +2097,8 @@ CodeGenFunction::EmitAsmInputLValue(const TargetInfo::ConstraintInfo &Info,
     } else {
       llvm::Type *Ty = ConvertType(InputType);
       uint64_t Size = CGM.getDataLayout().getTypeSizeInBits(Ty);
-      if (Size <= 64 && llvm::isPowerOf2_64(Size)) {
+      if ((Size <= 64 && llvm::isPowerOf2_64(Size)) ||
+          getTargetHooks().isScalarizableAsmOperand(*this, Ty)) {
         Ty = llvm::IntegerType::get(getLLVMContext(), Size);
         Ty = llvm::PointerType::getUnqual(Ty);
 
@@ -2320,23 +2321,28 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
 
     // If this is a register output, then make the inline asm return it
     // by-value.  If this is a memory result, return the value by-reference.
-    bool isScalarizableAggregate =
-        hasAggregateEvaluationKind(OutExpr->getType());
-    if (!Info.allowsMemory() && (hasScalarEvaluationKind(OutExpr->getType()) ||
-                                 isScalarizableAggregate)) {
+    QualType QTy = OutExpr->getType();
+    const bool IsScalarOrAggregate = hasScalarEvaluationKind(QTy) ||
+                                     hasAggregateEvaluationKind(QTy);
+    if (!Info.allowsMemory() && IsScalarOrAggregate) {
+
       Constraints += "=" + OutputConstraint;
-      ResultRegQualTys.push_back(OutExpr->getType());
+      ResultRegQualTys.push_back(QTy);
       ResultRegDests.push_back(Dest);
-      ResultTruncRegTypes.push_back(ConvertTypeForMem(OutExpr->getType()));
-      if (Info.allowsRegister() && isScalarizableAggregate) {
-        ResultTypeRequiresCast.push_back(true);
-        unsigned Size = getContext().getTypeSize(OutExpr->getType());
-        llvm::Type *ConvTy = llvm::IntegerType::get(getLLVMContext(), Size);
-        ResultRegTypes.push_back(ConvTy);
-      } else {
-        ResultTypeRequiresCast.push_back(false);
-        ResultRegTypes.push_back(ResultTruncRegTypes.back());
+
+      llvm::Type *Ty = ConvertTypeForMem(QTy);
+      const bool RequiresCast = Info.allowsRegister() &&
+          (getTargetHooks().isScalarizableAsmOperand(*this, Ty) ||
+           Ty->isAggregateType());
+
+      ResultTruncRegTypes.push_back(Ty);
+      ResultTypeRequiresCast.push_back(RequiresCast);
+
+      if (RequiresCast) {
+        unsigned Size = getContext().getTypeSize(QTy);
+        Ty = llvm::IntegerType::get(getLLVMContext(), Size);
       }
+      ResultRegTypes.push_back(Ty);
       // If this output is tied to an input, and if the input is larger, then
       // we need to set the actual result type of the inline asm node to be the
       // same as the input type.
@@ -2638,11 +2644,11 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
   assert(ResultTypeRequiresCast.size() <= ResultRegDests.size());
   for (unsigned i = 0, e = RegResults.size(); i != e; ++i) {
     llvm::Value *Tmp = RegResults[i];
+    llvm::Type *TruncTy = ResultTruncRegTypes[i];
 
     // If the result type of the LLVM IR asm doesn't match the result type of
     // the expression, do the conversion.
     if (ResultRegTypes[i] != ResultTruncRegTypes[i]) {
-      llvm::Type *TruncTy = ResultTruncRegTypes[i];
 
       // Truncate the integer result to the right size, note that TruncTy can be
       // a pointer.
@@ -2672,6 +2678,11 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
       unsigned Size = getContext().getTypeSize(ResultRegQualTys[i]);
       Address A = Builder.CreateBitCast(Dest.getAddress(*this),
                                         ResultRegTypes[i]->getPointerTo());
+      if (getTargetHooks().isScalarizableAsmOperand(*this, TruncTy)) {
+        Builder.CreateStore(Tmp, A);
+        continue;
+      }
+
       QualType Ty = getContext().getIntTypeForBitwidth(Size, /*Signed*/ false);
       if (Ty.isNull()) {
         const Expr *OutExpr = S.getOutputExpr(i);
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp b/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
index 9b40b88ea3c9..49a1396b58e3 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
@@ -186,7 +186,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO,
       !getModule().getSourceFileName().empty()) {
*** 9101 LINES SKIPPED ***