git: 26ebd6ad3b79 - stable/13 - Merge llvm-project release/14.x llvmorg-14.0.0-rc1-74-g4dc3cb8e3255
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 04 Jun 2022 12:01:15 UTC
The branch stable/13 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=26ebd6ad3b79ce475b374de1076421f4a4c47d12
commit 26ebd6ad3b79ce475b374de1076421f4a4c47d12
Author: Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-02-18 22:41:20 +0000
Commit: Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-06-04 11:59:42 +0000
Merge llvm-project release/14.x llvmorg-14.0.0-rc1-74-g4dc3cb8e3255
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14.0.0-rc1-74-g4dc3cb8e3255.
PR: 261742
MFC after: 2 weeks
(cherry picked from commit d56accc7c3dcc897489b6a07834763a03b9f3d68)
---
.../clang/include/clang/Basic/Builtins.def | 56 +--
.../clang/include/clang/Basic/Builtins.h | 25 +-
.../include/clang/Basic/DiagnosticCommonKinds.td | 4 +-
.../clang/include/clang/Basic/TargetInfo.h | 4 +-
contrib/llvm-project/clang/lib/Basic/Builtins.cpp | 26 +-
.../clang/lib/CodeGen/CodeGenModule.cpp | 8 +
.../llvm-project/clang/lib/CodeGen/TargetInfo.cpp | 34 ++
.../clang/lib/Driver/ToolChains/Clang.cpp | 37 +-
.../clang/lib/Driver/ToolChains/Hexagon.cpp | 34 +-
.../clang/lib/Driver/ToolChains/MSVC.cpp | 4 +-
.../clang/lib/Driver/ToolChains/MinGW.cpp | 4 +-
.../clang/lib/Driver/ToolChains/MinGW.h | 2 +
.../clang/lib/Driver/ToolChains/OpenBSD.cpp | 9 +-
.../clang/lib/Format/DefinitionBlockSeparator.cpp | 49 ++-
.../clang/lib/Format/QualifierAlignmentFixer.cpp | 4 +
.../clang/lib/Format/UnwrappedLineParser.cpp | 3 +-
.../llvm-project/clang/lib/Headers/opencl-c-base.h | 2 +
contrib/llvm-project/clang/lib/Headers/opencl-c.h | 6 +
.../clang/lib/Headers/ppc_wrappers/mm_malloc.h | 2 +-
.../llvm-project/clang/lib/Sema/OpenCLBuiltins.td | 416 +++++++--------------
.../llvm-project/clang/lib/Sema/SemaChecking.cpp | 10 +-
contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp | 17 -
.../compiler-rt/lib/asan/asan_errors.h | 4 +-
.../lib/sanitizer_common/sanitizer_common.h | 2 +-
.../lib/sanitizer_common/sanitizer_linux.cpp | 46 +--
.../sanitizer_common/sanitizer_linux_libcdep.cpp | 27 +-
.../lib/sanitizer_common/sanitizer_mac.cpp | 4 +-
.../sanitizer_symbolizer_report.cpp | 4 +-
.../lib/sanitizer_common/sanitizer_win.cpp | 10 +-
.../lib/tsan/rtl/tsan_interceptors_posix.cpp | 10 +-
.../libcxx/include/__algorithm/in_in_out_result.h | 4 +-
.../libcxx/include/__algorithm/in_out_result.h | 4 +-
contrib/llvm-project/libcxx/include/__config | 2 +
.../include/__filesystem/directory_iterator.h | 2 +-
.../__filesystem/recursive_directory_iterator.h | 2 +-
.../include/__functional/ranges_operations.h | 5 +-
.../libcxx/include/__iterator/advance.h | 4 +-
.../libcxx/include/__iterator/distance.h | 4 +-
.../libcxx/include/__iterator/insert_iterator.h | 2 +-
.../libcxx/include/__iterator/iter_move.h | 2 +-
.../libcxx/include/__iterator/iter_swap.h | 1 -
.../llvm-project/libcxx/include/__iterator/next.h | 4 +-
.../llvm-project/libcxx/include/__iterator/prev.h | 4 +-
.../libcxx/include/__memory/concepts.h | 6 +-
.../libcxx/include/__memory/ranges_construct_at.h | 4 +-
.../__memory/ranges_uninitialized_algorithms.h | 6 +-
contrib/llvm-project/libcxx/include/__ranges/all.h | 4 +-
.../libcxx/include/__ranges/common_view.h | 4 +-
.../libcxx/include/__ranges/concepts.h | 12 +-
.../libcxx/include/__ranges/copyable_box.h | 4 +-
.../llvm-project/libcxx/include/__ranges/counted.h | 4 +-
.../libcxx/include/__ranges/dangling.h | 2 +-
.../llvm-project/libcxx/include/__ranges/data.h | 4 +-
.../libcxx/include/__ranges/drop_view.h | 4 +-
.../llvm-project/libcxx/include/__ranges/empty.h | 4 +-
.../libcxx/include/__ranges/empty_view.h | 4 +-
.../include/__ranges/enable_borrowed_range.h | 3 +-
.../libcxx/include/__ranges/enable_view.h | 2 +-
.../libcxx/include/__ranges/iota_view.h | 4 +-
.../libcxx/include/__ranges/join_view.h | 4 +-
.../include/__ranges/non_propagating_cache.h | 4 +-
.../libcxx/include/__ranges/owning_view.h | 4 +-
.../libcxx/include/__ranges/range_adaptor.h | 4 +-
.../libcxx/include/__ranges/ref_view.h | 4 +-
.../libcxx/include/__ranges/reverse_view.h | 4 +-
.../libcxx/include/__ranges/single_view.h | 4 +-
.../llvm-project/libcxx/include/__ranges/size.h | 4 +-
.../libcxx/include/__ranges/subrange.h | 4 +-
.../libcxx/include/__ranges/take_view.h | 4 +-
.../libcxx/include/__ranges/transform_view.h | 4 +-
.../libcxx/include/__ranges/view_interface.h | 4 +-
.../libcxx/include/__threading_support | 56 ---
contrib/llvm-project/libcxx/include/ranges | 12 +-
contrib/llvm-project/libcxx/include/span | 19 +-
contrib/llvm-project/libcxx/include/string | 4 +
contrib/llvm-project/libcxx/include/string_view | 8 +-
contrib/llvm-project/libcxx/include/vector | 93 ++---
contrib/llvm-project/libcxx/src/vector.cpp | 17 +-
.../libunwind/include/__libunwind_config.h | 8 +
.../libunwind/src/DwarfInstructions.hpp | 19 +
contrib/llvm-project/libunwind/src/DwarfParser.hpp | 27 +-
contrib/llvm-project/libunwind/src/Registers.hpp | 186 +++++++++
.../llvm-project/libunwind/src/UnwindCursor.hpp | 16 +
.../libunwind/src/UnwindRegistersRestore.S | 47 +++
.../libunwind/src/UnwindRegistersSave.S | 58 +++
contrib/llvm-project/libunwind/src/config.h | 11 +-
contrib/llvm-project/libunwind/src/libunwind.cpp | 2 +
contrib/llvm-project/lld/ELF/Arch/PPC64.cpp | 7 +-
contrib/llvm-project/lld/ELF/Driver.cpp | 35 +-
contrib/llvm-project/lld/ELF/InputFiles.cpp | 11 +-
contrib/llvm-project/lld/ELF/OutputSections.cpp | 2 +-
contrib/llvm-project/lld/docs/ReleaseNotes.rst | 152 +++++++-
.../llvm-project/lldb/include/lldb/Core/Mangled.h | 11 +-
.../lldb/include/lldb/Core/RichManglingContext.h | 29 +-
.../lldb/include/lldb/Target/Process.h | 38 +-
.../lldb/source/Commands/CommandObjectMemory.cpp | 20 +-
.../lldb/source/Commands/CommandObjectThread.cpp | 49 +++
contrib/llvm-project/lldb/source/Core/Mangled.cpp | 21 +-
.../lldb/source/Core/RichManglingContext.cpp | 46 +--
.../ASan/InstrumentationRuntimeASan.cpp | 2 +-
.../Plugins/Process/elf-core/ProcessElfCore.cpp | 4 +-
.../Plugins/Process/elf-core/ProcessElfCore.h | 8 +-
.../Process/gdb-remote/ProcessGDBRemote.cpp | 4 +-
.../Plugins/Process/gdb-remote/ProcessGDBRemote.h | 6 +-
.../Plugins/Process/minidump/ProcessMinidump.cpp | 4 +-
.../Plugins/Process/minidump/ProcessMinidump.h | 6 +-
.../Plugins/Process/scripted/ScriptedProcess.cpp | 4 +-
.../Plugins/Process/scripted/ScriptedProcess.h | 6 +-
contrib/llvm-project/lldb/source/Symbol/Symtab.cpp | 11 +-
.../llvm-project/lldb/source/Target/Process.cpp | 23 +-
.../llvm/include/llvm/CodeGen/TargetLowering.h | 8 +
.../include/llvm/DebugInfo/Symbolize/DIFetcher.h | 51 +++
.../include/llvm/DebugInfo/Symbolize/Symbolize.h | 13 +
.../llvm/include/llvm/Debuginfod/DIFetcher.h | 34 ++
.../llvm/include/llvm/Support/Compiler.h | 2 +
.../CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp | 376 ++++++++++++++-----
.../CodeGen/LiveDebugValues/InstrRefBasedImpl.h | 63 +++-
.../CodeGen/LiveDebugValues/LiveDebugValues.cpp | 5 +
.../llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 73 +++-
.../llvm/lib/DebugInfo/Symbolize/DIFetcher.cpp | 58 +++
.../llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | 161 ++++----
.../llvm-project/llvm/lib/Debuginfod/DIFetcher.cpp | 28 ++
.../llvm-project/llvm/lib/Support/RISCVISAInfo.cpp | 23 +-
.../llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td | 53 +--
.../llvm/lib/Target/AArch64/SVEInstrFormats.td | 25 +-
.../lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp | 35 +-
.../RISCV/Disassembler/RISCVDisassembler.cpp | 32 ++
.../llvm-project/llvm/lib/Target/RISCV/RISCV.td | 37 ++
.../llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 8 -
.../llvm/lib/Target/RISCV/RISCVFrameLowering.h | 2 -
.../llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 36 +-
.../llvm/lib/Target/RISCV/RISCVInstrInfoD.td | 215 +++++++----
.../llvm/lib/Target/RISCV/RISCVInstrInfoF.td | 281 ++++++++++----
.../llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td | 213 +++++++----
.../llvm/lib/Target/RISCV/RISCVRegisterInfo.td | 30 ++
.../llvm/lib/Target/RISCV/RISCVSubtarget.h | 8 +
contrib/llvm-project/llvm/lib/Target/X86/X86.td | 2 +
.../llvm/lib/Target/X86/X86FrameLowering.cpp | 5 +-
.../llvm/lib/Target/X86/X86ISelLowering.cpp | 46 +--
.../llvm/lib/Target/X86/X86ISelLowering.h | 3 +
.../lib/Transforms/IPO/AttributorAttributes.cpp | 84 +++--
.../llvm/lib/Transforms/IPO/OpenMPOpt.cpp | 1 -
.../lib/Transforms/Scalar/InferAddressSpaces.cpp | 11 +-
.../lib/Transforms/Vectorize/LoopVectorize.cpp | 35 +-
.../lib/Transforms/Vectorize/SLPVectorizer.cpp | 179 +--------
.../llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp | 9 +-
.../openmp/runtime/src/kmp_affinity.cpp | 2 +-
lib/clang/include/VCSVersion.inc | 6 +-
lib/clang/include/lld/Common/Version.inc | 2 +-
lib/clang/include/llvm/Config/config.h | 5 -
lib/clang/include/llvm/Config/llvm-config.h | 6 +
lib/clang/include/llvm/Support/VCSRevision.h | 2 +-
lib/clang/libllvm/Makefile | 2 +
lib/libclang_rt/Makefile | 2 +
lib/libclang_rt/asan_dynamic/Makefile | 9 +-
lib/libclang_rt/asan_static/Makefile | 10 +
lib/libclang_rt/fuzzer_interceptors/Makefile | 9 +
157 files changed, 2809 insertions(+), 1595 deletions(-)
diff --git a/contrib/llvm-project/clang/include/clang/Basic/Builtins.def b/contrib/llvm-project/clang/include/clang/Basic/Builtins.def
index d2cb14d2fd8c..a17d2e59f5d8 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/Builtins.def
+++ b/contrib/llvm-project/clang/include/clang/Basic/Builtins.def
@@ -1625,50 +1625,50 @@ LANGBUILTIN(__builtin_coro_suspend, "cIb", "n", COR_LANG)
// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
// We need the generic prototype, since the packet type could be anything.
-LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
-LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG)
+LANGBUILTIN(read_pipe, "i.", "tn", OCL_PIPE)
+LANGBUILTIN(write_pipe, "i.", "tn", OCL_PIPE)
-LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG)
-LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG)
+LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCL_PIPE)
+LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCL_PIPE)
-LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG)
-LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG)
+LANGBUILTIN(commit_write_pipe, "v.", "tn", OCL_PIPE)
+LANGBUILTIN(commit_read_pipe, "v.", "tn", OCL_PIPE)
-LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
-LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
+LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCL_PIPE)
+LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCL_PIPE)
-LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
-LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
+LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCL_PIPE)
+LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCL_PIPE)
-LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
-LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
+LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCL_PIPE)
+LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCL_PIPE)
-LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
-LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
+LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCL_PIPE)
+LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCL_PIPE)
-LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
-LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
+LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCL_PIPE)
+LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCL_PIPE)
// OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
// Custom builtin check allows to perform special check of passed block arguments.
-LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
-LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC20_LANG)
-LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCLC20_LANG)
-LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCLC20_LANG)
-LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC20_LANG)
+LANGBUILTIN(enqueue_kernel, "i.", "tn", OCL_DSE)
+LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCL_DSE)
+LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCL_DSE)
+LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCL_DSE)
+LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCL_DSE)
// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
// FIXME: Pointer parameters of OpenCL builtins should have their address space
// requirement defined.
-LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
-LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
-LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
+LANGBUILTIN(to_global, "v*v*", "tn", OCL_GAS)
+LANGBUILTIN(to_local, "v*v*", "tn", OCL_GAS)
+LANGBUILTIN(to_private, "v*v*", "tn", OCL_GAS)
// OpenCL half load/store builtin
-LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES)
-LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES)
-LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES)
-LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES)
+LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCL_LANGUAGES)
+LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCL_LANGUAGES)
+LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCL_LANGUAGES)
+LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCL_LANGUAGES)
// Builtins for os_log/os_trace
BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nut")
diff --git a/contrib/llvm-project/clang/include/clang/Basic/Builtins.h b/contrib/llvm-project/clang/include/clang/Basic/Builtins.h
index cdaaee48c32d..1dabafce54f3 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/Builtins.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/Builtins.h
@@ -28,20 +28,21 @@ class IdentifierTable;
class LangOptions;
enum LanguageID {
- GNU_LANG = 0x1, // builtin requires GNU mode.
- C_LANG = 0x2, // builtin for c only.
- CXX_LANG = 0x4, // builtin for cplusplus only.
- OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
- MS_LANG = 0x10, // builtin requires MS mode.
- OCLC20_LANG = 0x20, // builtin for OpenCL C 2.0 only.
- OCLC1X_LANG = 0x40, // builtin for OpenCL C 1.x only.
- OMP_LANG = 0x80, // builtin requires OpenMP.
- CUDA_LANG = 0x100, // builtin requires CUDA.
- COR_LANG = 0x200, // builtin requires use of 'fcoroutine-ts' option.
+ GNU_LANG = 0x1, // builtin requires GNU mode.
+ C_LANG = 0x2, // builtin for c only.
+ CXX_LANG = 0x4, // builtin for cplusplus only.
+ OBJC_LANG = 0x8, // builtin for objective-c and objective-c++
+ MS_LANG = 0x10, // builtin requires MS mode.
+ OMP_LANG = 0x20, // builtin requires OpenMP.
+ CUDA_LANG = 0x40, // builtin requires CUDA.
+ COR_LANG = 0x80, // builtin requires use of 'fcoroutine-ts' option.
+ OCL_GAS = 0x100, // builtin requires OpenCL generic address space.
+ OCL_PIPE = 0x200, // builtin requires OpenCL pipe.
+ OCL_DSE = 0x400, // builtin requires OpenCL device side enqueue.
+ ALL_OCL_LANGUAGES = 0x800, // builtin for OCL languages.
ALL_LANGUAGES = C_LANG | CXX_LANG | OBJC_LANG, // builtin for all languages.
ALL_GNU_LANGUAGES = ALL_LANGUAGES | GNU_LANG, // builtin requires GNU mode.
- ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG, // builtin requires MS mode.
- ALL_OCLC_LANGUAGES = OCLC1X_LANG | OCLC20_LANG // builtin for OCLC languages.
+ ALL_MS_LANGUAGES = ALL_LANGUAGES | MS_LANG // builtin requires MS mode.
};
namespace Builtin {
diff --git a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticCommonKinds.td b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticCommonKinds.td
index 5ea55b0fd31b..421527827a4b 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -145,8 +145,8 @@ def warn_conflicting_nullability_attr_overriding_param_types : Warning<
def err_nullability_conflicting : Error<
"nullability specifier %0 conflicts with existing specifier %1">;
-def warn_target_unsupported_branch_protection_option: Warning <
- "ignoring '-mbranch-protection=' option because the '%0' architecture does not support it">,
+def warn_incompatible_branch_protection_option: Warning <
+ "'-mbranch-protection=' option is incompatible with the '%0' architecture">,
InGroup<BranchProtection>;
def warn_target_unsupported_branch_protection_attribute: Warning <
diff --git a/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h b/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
index a49342a34f3e..e7db877f4e2b 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
+++ b/contrib/llvm-project/clang/include/clang/Basic/TargetInfo.h
@@ -644,8 +644,8 @@ public:
}
/// Return the largest alignment for which a suitably-sized allocation with
- /// '::operator new(size_t)' or 'malloc' is guaranteed to produce a
- /// correctly-aligned pointer.
+ /// '::operator new(size_t)' is guaranteed to produce a correctly-aligned
+ /// pointer.
unsigned getNewAlign() const {
return NewAlign ? NewAlign : std::max(LongDoubleAlign, LongLongAlign);
}
diff --git a/contrib/llvm-project/clang/lib/Basic/Builtins.cpp b/contrib/llvm-project/clang/lib/Basic/Builtins.cpp
index 2b0f4071662c..6d278e9c4a22 100644
--- a/contrib/llvm-project/clang/lib/Basic/Builtins.cpp
+++ b/contrib/llvm-project/clang/lib/Basic/Builtins.cpp
@@ -69,22 +69,26 @@ bool Builtin::Context::builtinIsSupported(const Builtin::Info &BuiltinInfo,
bool MSModeUnsupported =
!LangOpts.MicrosoftExt && (BuiltinInfo.Langs & MS_LANG);
bool ObjCUnsupported = !LangOpts.ObjC && BuiltinInfo.Langs == OBJC_LANG;
- bool OclC1Unsupported = (LangOpts.OpenCLVersion / 100) != 1 &&
- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES ) == OCLC1X_LANG;
- bool OclC2Unsupported =
- (LangOpts.getOpenCLCompatibleVersion() != 200) &&
- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES) == OCLC20_LANG;
- bool OclCUnsupported = !LangOpts.OpenCL &&
- (BuiltinInfo.Langs & ALL_OCLC_LANGUAGES);
+ bool OclCUnsupported =
+ !LangOpts.OpenCL && (BuiltinInfo.Langs & ALL_OCL_LANGUAGES);
+ bool OclGASUnsupported =
+ !LangOpts.OpenCLGenericAddressSpace && (BuiltinInfo.Langs & OCL_GAS);
+ bool OclPipeUnsupported =
+ !LangOpts.OpenCLPipes && (BuiltinInfo.Langs & OCL_PIPE);
+ // Device side enqueue is not supported until OpenCL 2.0. In 2.0 and higher
+ // support is indicated with language option for blocks.
+ bool OclDSEUnsupported =
+ (LangOpts.getOpenCLCompatibleVersion() < 200 || !LangOpts.Blocks) &&
+ (BuiltinInfo.Langs & OCL_DSE);
bool OpenMPUnsupported = !LangOpts.OpenMP && BuiltinInfo.Langs == OMP_LANG;
bool CUDAUnsupported = !LangOpts.CUDA && BuiltinInfo.Langs == CUDA_LANG;
bool CPlusPlusUnsupported =
!LangOpts.CPlusPlus && BuiltinInfo.Langs == CXX_LANG;
return !BuiltinsUnsupported && !CorBuiltinsUnsupported &&
- !MathBuiltinsUnsupported && !OclCUnsupported && !OclC1Unsupported &&
- !OclC2Unsupported && !OpenMPUnsupported && !GnuModeUnsupported &&
- !MSModeUnsupported && !ObjCUnsupported && !CPlusPlusUnsupported &&
- !CUDAUnsupported;
+ !MathBuiltinsUnsupported && !OclCUnsupported && !OclGASUnsupported &&
+ !OclPipeUnsupported && !OclDSEUnsupported && !OpenMPUnsupported &&
+ !GnuModeUnsupported && !MSModeUnsupported && !ObjCUnsupported &&
+ !CPlusPlusUnsupported && !CUDAUnsupported;
}
/// initializeBuiltins - Mark the identifiers for all the builtins with their
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp b/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
index 2346176a1562..29806b65e984 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp
@@ -4381,6 +4381,14 @@ LangAS CodeGenModule::GetGlobalConstantAddressSpace() const {
return LangAS::opencl_constant;
if (LangOpts.SYCLIsDevice)
return LangAS::sycl_global;
+ if (LangOpts.HIP && LangOpts.CUDAIsDevice && getTriple().isSPIRV())
+ // For HIPSPV map literals to cuda_device (maps to CrossWorkGroup in SPIR-V)
+ // instead of default AS (maps to Generic in SPIR-V). Otherwise, we end up
+ // with OpVariable instructions with Generic storage class which is not
+ // allowed (SPIR-V V1.6 s3.42.8). Also, mapping literals to SPIR-V
+ // UniformConstant storage class is not viable as pointers to it may not be
+ // casted to Generic pointers which are used to model HIP's "flat" pointers.
+ return LangAS::cuda_device;
if (auto AS = getTarget().getConstantAddressSpace())
return AS.getValue();
return LangAS::Default;
diff --git a/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp b/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp
index 8a0150218a7a..9af3004ebcc5 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp
@@ -9474,6 +9474,28 @@ class SparcV8TargetCodeGenInfo : public TargetCodeGenInfo {
public:
SparcV8TargetCodeGenInfo(CodeGenTypes &CGT)
: TargetCodeGenInfo(std::make_unique<SparcV8ABIInfo>(CGT)) {}
+
+ llvm::Value *decodeReturnAddress(CodeGen::CodeGenFunction &CGF,
+ llvm::Value *Address) const override {
+ int Offset;
+ if (isAggregateTypeForABI(CGF.CurFnInfo->getReturnType()))
+ Offset = 12;
+ else
+ Offset = 8;
+ return CGF.Builder.CreateGEP(CGF.Int8Ty, Address,
+ llvm::ConstantInt::get(CGF.Int32Ty, Offset));
+ }
+
+ llvm::Value *encodeReturnAddress(CodeGen::CodeGenFunction &CGF,
+ llvm::Value *Address) const override {
+ int Offset;
+ if (isAggregateTypeForABI(CGF.CurFnInfo->getReturnType()))
+ Offset = -12;
+ else
+ Offset = -8;
+ return CGF.Builder.CreateGEP(CGF.Int8Ty, Address,
+ llvm::ConstantInt::get(CGF.Int32Ty, Offset));
+ }
};
} // end anonymous namespace
@@ -9748,6 +9770,18 @@ public:
bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const override;
+
+ llvm::Value *decodeReturnAddress(CodeGen::CodeGenFunction &CGF,
+ llvm::Value *Address) const override {
+ return CGF.Builder.CreateGEP(CGF.Int8Ty, Address,
+ llvm::ConstantInt::get(CGF.Int32Ty, 8));
+ }
+
+ llvm::Value *encodeReturnAddress(CodeGen::CodeGenFunction &CGF,
+ llvm::Value *Address) const override {
+ return CGF.Builder.CreateGEP(CGF.Int8Ty, Address,
+ llvm::ConstantInt::get(CGF.Int32Ty, -8));
+ }
};
} // end anonymous namespace
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
index 7aac977209eb..f2f18e901ab0 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1639,7 +1639,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
const Driver &D = TC.getDriver();
const llvm::Triple &Triple = TC.getEffectiveTriple();
if (!(isAArch64 || (Triple.isArmT32() && Triple.isArmMClass())))
- D.Diag(diag::warn_target_unsupported_branch_protection_option)
+ D.Diag(diag::warn_incompatible_branch_protection_option)
<< Triple.getArchName();
StringRef Scope, Key;
@@ -8148,11 +8148,25 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
+ const Driver &D = getToolChain().getDriver();
+ const llvm::Triple TheTriple = getToolChain().getTriple();
+ auto OpenMPTCRange = C.getOffloadToolChains<Action::OFK_OpenMP>();
ArgStringList CmdArgs;
- if (getToolChain().getDriver().isUsingLTO(/* IsOffload */ true)) {
+ // Pass the CUDA path to the linker wrapper tool.
+ for (auto &I : llvm::make_range(OpenMPTCRange.first, OpenMPTCRange.second)) {
+ const ToolChain *TC = I.second;
+ if (TC->getTriple().isNVPTX()) {
+ CudaInstallationDetector CudaInstallation(D, TheTriple, Args);
+ if (CudaInstallation.isValid())
+ CmdArgs.push_back(Args.MakeArgString(
+ "--cuda-path=" + CudaInstallation.getInstallPath()));
+ break;
+ }
+ }
+
+ if (D.isUsingLTO(/* IsOffload */ true)) {
// Pass in target features for each toolchain.
- auto OpenMPTCRange = C.getOffloadToolChains<Action::OFK_OpenMP>();
for (auto &I :
llvm::make_range(OpenMPTCRange.first, OpenMPTCRange.second)) {
const ToolChain *TC = I.second;
@@ -8165,9 +8179,10 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
}
// Pass in the bitcode library to be linked during LTO.
- for (auto &I : llvm::make_range(OpenMPTCRange.first, OpenMPTCRange.second)) {
+ for (auto &I :
+ llvm::make_range(OpenMPTCRange.first, OpenMPTCRange.second)) {
const ToolChain *TC = I.second;
- const Driver &D = TC->getDriver();
+ const Driver &TCDriver = TC->getDriver();
const ArgList &TCArgs = C.getArgsForToolChain(TC, "", Action::OFK_OpenMP);
StringRef Arch = TCArgs.getLastArgValue(options::OPT_march_EQ);
@@ -8182,7 +8197,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
BitcodeSuffix += Arch;
ArgStringList BitcodeLibrary;
- addOpenMPDeviceRTL(D, TCArgs, BitcodeLibrary, BitcodeSuffix,
+ addOpenMPDeviceRTL(TCDriver, TCArgs, BitcodeLibrary, BitcodeSuffix,
TC->getTriple());
if (!BitcodeLibrary.empty())
@@ -8210,12 +8225,8 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
}
}
- // Construct the link job so we can wrap around it.
- Linker->ConstructJob(C, JA, Output, Inputs, Args, LinkingOutput);
- const auto &LinkCommand = C.getJobs().getJobs().back();
-
CmdArgs.push_back("-host-triple");
- CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
+ CmdArgs.push_back(Args.MakeArgString(TheTriple.getTriple()));
if (Args.hasArg(options::OPT_v))
CmdArgs.push_back("-v");
@@ -8246,6 +8257,10 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.getLastArg(options::OPT_save_temps_EQ))
CmdArgs.push_back("-save-temps");
+ // Construct the link job so we can wrap around it.
+ Linker->ConstructJob(C, JA, Output, Inputs, Args, LinkingOutput);
+ const auto &LinkCommand = C.getJobs().getJobs().back();
+
// Add the linker arguments to be forwarded by the wrapper.
CmdArgs.push_back("-linker-path");
CmdArgs.push_back(LinkCommand->getExecutable());
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Hexagon.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Hexagon.cpp
index ba3040636604..e772122f5ff5 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Hexagon.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -72,23 +72,25 @@ static void handleHVXTargetFeatures(const Driver &D, const ArgList &Args,
(Cpu.back() == 'T' || Cpu.back() == 't' ? Cpu.drop_back(1) : Cpu).str();
HasHVX = false;
- // Handle -mhvx, -mhvx=, -mno-hvx. If both present, -mhvx= wins over -mhvx.
- auto argOrNull = [&Args](auto FlagOn, auto FlagOff) -> Arg* {
- if (Arg *A = Args.getLastArg(FlagOn, FlagOff)) {
- if (A->getOption().matches(FlagOn))
- return A;
- }
- return nullptr;
- };
-
- Arg *HvxBareA =
- argOrNull(options::OPT_mhexagon_hvx, options::OPT_mno_hexagon_hvx);
- Arg *HvxVerA =
- argOrNull(options::OPT_mhexagon_hvx_EQ, options::OPT_mno_hexagon_hvx);
+ // Handle -mhvx, -mhvx=, -mno-hvx. If versioned and versionless flags
+ // are both present, the last one wins.
+ Arg *HvxEnablingArg =
+ Args.getLastArg(options::OPT_mhexagon_hvx, options::OPT_mhexagon_hvx_EQ,
+ options::OPT_mno_hexagon_hvx);
+ if (HvxEnablingArg) {
+ if (HvxEnablingArg->getOption().matches(options::OPT_mno_hexagon_hvx))
+ HvxEnablingArg = nullptr;
+ }
- if (Arg *A = HvxVerA ? HvxVerA : HvxBareA) {
- if (A->getOption().matches(options::OPT_mhexagon_hvx_EQ))
- HvxVer = StringRef(A->getValue()).lower(); // lower produces std:string
+ if (HvxEnablingArg) {
+ // If -mhvx[=] was given, it takes precedence.
+ if (Arg *A = Args.getLastArg(options::OPT_mhexagon_hvx,
+ options::OPT_mhexagon_hvx_EQ)) {
+ // If the version was given, set HvxVer. Otherwise HvxVer
+ // will remain equal to the CPU version.
+ if (A->getOption().matches(options::OPT_mhexagon_hvx_EQ))
+ HvxVer = StringRef(A->getValue()).lower();
+ }
HasHVX = true;
Features.push_back(makeFeature(Twine("hvx") + HvxVer, true));
} else if (Arg *A = Args.getLastArg(options::OPT_mno_hexagon_hvx)) {
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/MSVC.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/MSVC.cpp
index 18cef288f018..9f4751167ac1 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -1393,8 +1393,8 @@ VersionTuple MSVCToolChain::computeMSVCVersion(const Driver *D,
if (MSVT.empty() &&
Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
IsWindowsMSVC)) {
- // -fms-compatibility-version=19.14 is default, aka 2017, 15.7
- MSVT = VersionTuple(19, 14);
+ // -fms-compatibility-version=19.20 is default, aka 2019, 16.x
+ MSVT = VersionTuple(19, 20);
}
return MSVT;
}
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.cpp
index 0501f9737404..ceeaa79bc202 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -86,7 +86,9 @@ void tools::MinGW::Linker::AddLibGCC(const ArgList &Args,
CmdArgs.push_back("-lmoldname");
CmdArgs.push_back("-lmingwex");
for (auto Lib : Args.getAllArgValues(options::OPT_l))
- if (StringRef(Lib).startswith("msvcr") || StringRef(Lib).startswith("ucrt"))
+ if (StringRef(Lib).startswith("msvcr") ||
+ StringRef(Lib).startswith("ucrt") ||
+ StringRef(Lib).startswith("crtdll"))
return;
CmdArgs.push_back("-lmsvcrt");
}
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.h b/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.h
index c3de19b97724..c9553b4f4652 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.h
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/MinGW.h
@@ -90,6 +90,8 @@ public:
void printVerboseInfo(raw_ostream &OS) const override;
+ unsigned GetDefaultDwarfVersion() const override { return 4; }
+
protected:
Tool *getTool(Action::ActionClass AC) const override;
Tool *buildLinker() const override;
diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/OpenBSD.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/OpenBSD.cpp
index 96abac57764f..bcd54bedfa89 100644
--- a/contrib/llvm-project/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -160,7 +160,8 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
assert(Output.isNothing() && "Invalid output.");
}
- if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
+ options::OPT_r)) {
const char *crt0 = nullptr;
const char *crtbegin = nullptr;
if (!Args.hasArg(options::OPT_shared)) {
@@ -191,7 +192,8 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
- if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
+ options::OPT_r)) {
// Use the static OpenMP runtime with -static-openmp
bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
!Args.hasArg(options::OPT_static);
@@ -234,7 +236,8 @@ void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-lcompiler_rt");
}
- if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+ if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
+ options::OPT_r)) {
const char *crtend = nullptr;
if (!Args.hasArg(options::OPT_shared))
crtend = "crtend.o";
diff --git a/contrib/llvm-project/clang/lib/Format/DefinitionBlockSeparator.cpp b/contrib/llvm-project/clang/lib/Format/DefinitionBlockSeparator.cpp
index 827564357f78..cfb019a471dc 100644
--- a/contrib/llvm-project/clang/lib/Format/DefinitionBlockSeparator.cpp
+++ b/contrib/llvm-project/clang/lib/Format/DefinitionBlockSeparator.cpp
@@ -35,19 +35,31 @@ void DefinitionBlockSeparator::separateBlocks(
const bool IsNeverStyle =
Style.SeparateDefinitionBlocks == FormatStyle::SDS_Never;
const AdditionalKeywords &ExtraKeywords = Tokens.getKeywords();
- auto LikelyDefinition = [this, ExtraKeywords](const AnnotatedLine *Line,
- bool ExcludeEnum = false) {
+ auto GetBracketLevelChange = [](const FormatToken *Tok) {
+ if (Tok->isOneOf(tok::l_brace, tok::l_paren, tok::l_square))
+ return 1;
+ if (Tok->isOneOf(tok::r_brace, tok::r_paren, tok::r_square))
+ return -1;
+ return 0;
+ };
+ auto LikelyDefinition = [&](const AnnotatedLine *Line,
+ bool ExcludeEnum = false) {
if ((Line->MightBeFunctionDecl && Line->mightBeFunctionDefinition()) ||
Line->startsWithNamespace())
return true;
- FormatToken *CurrentToken = Line->First;
- while (CurrentToken) {
- if (CurrentToken->isOneOf(tok::kw_class, tok::kw_struct) ||
- (Style.isJavaScript() && CurrentToken->is(ExtraKeywords.kw_function)))
- return true;
- if (!ExcludeEnum && CurrentToken->is(tok::kw_enum))
- return true;
- CurrentToken = CurrentToken->Next;
+ int BracketLevel = 0;
+ for (const FormatToken *CurrentToken = Line->First; CurrentToken;
+ CurrentToken = CurrentToken->Next) {
+ if (BracketLevel == 0) {
+ if ((CurrentToken->isOneOf(tok::kw_class, tok::kw_struct,
+ tok::kw_union) ||
+ (Style.isJavaScript() &&
+ CurrentToken->is(ExtraKeywords.kw_function))))
+ return true;
+ if (!ExcludeEnum && CurrentToken->is(tok::kw_enum))
+ return true;
+ }
+ BracketLevel += GetBracketLevelChange(CurrentToken);
}
return false;
};
@@ -102,14 +114,17 @@ void DefinitionBlockSeparator::separateBlocks(
IsPPConditional(OpeningLineIndex - 1);
};
const auto HasEnumOnLine = [&]() {
- FormatToken *CurrentToken = CurrentLine->First;
bool FoundEnumKeyword = false;
- while (CurrentToken) {
- if (CurrentToken->is(tok::kw_enum))
- FoundEnumKeyword = true;
- else if (FoundEnumKeyword && CurrentToken->is(tok::l_brace))
- return true;
- CurrentToken = CurrentToken->Next;
+ int BracketLevel = 0;
+ for (const FormatToken *CurrentToken = CurrentLine->First; CurrentToken;
+ CurrentToken = CurrentToken->Next) {
+ if (BracketLevel == 0) {
+ if (CurrentToken->is(tok::kw_enum))
+ FoundEnumKeyword = true;
+ else if (FoundEnumKeyword && CurrentToken->is(tok::l_brace))
+ return true;
+ }
+ BracketLevel += GetBracketLevelChange(CurrentToken);
}
return FoundEnumKeyword && I + 1 < Lines.size() &&
Lines[I + 1]->First->is(tok::l_brace);
diff --git a/contrib/llvm-project/clang/lib/Format/QualifierAlignmentFixer.cpp b/contrib/llvm-project/clang/lib/Format/QualifierAlignmentFixer.cpp
index b3a4684bead1..0142a6c08ed3 100644
--- a/contrib/llvm-project/clang/lib/Format/QualifierAlignmentFixer.cpp
+++ b/contrib/llvm-project/clang/lib/Format/QualifierAlignmentFixer.cpp
@@ -396,6 +396,10 @@ LeftRightQualifierAlignmentFixer::analyze(
for (AnnotatedLine *Line : AnnotatedLines) {
FormatToken *First = Line->First;
+ assert(First);
+ if (First->Finalized)
+ continue;
+
const auto *Last = Line->Last;
for (const auto *Tok = First; Tok && Tok != Last && Tok->Next;
diff --git a/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp b/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp
index 642679128409..2e2293c6d58b 100644
--- a/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/contrib/llvm-project/clang/lib/Format/UnwrappedLineParser.cpp
@@ -3102,7 +3102,8 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
}
if (FormatTok->is(tok::l_square)) {
FormatToken *Previous = FormatTok->Previous;
- if (!Previous || Previous->isNot(tok::r_paren)) {
+ if (!Previous ||
+ !(Previous->is(tok::r_paren) || Previous->isTypeOrIdentifier())) {
// Don't try parsing a lambda if we had a closing parenthesis before,
// it was probably a pointer to an array: int (*)[].
if (!tryToParseLambda())
diff --git a/contrib/llvm-project/clang/lib/Headers/opencl-c-base.h b/contrib/llvm-project/clang/lib/Headers/opencl-c-base.h
index ad276dc0f6aa..5191c41bcd05 100644
--- a/contrib/llvm-project/clang/lib/Headers/opencl-c-base.h
+++ b/contrib/llvm-project/clang/lib/Headers/opencl-c-base.h
@@ -67,6 +67,8 @@
#if (__OPENCL_CPP_VERSION__ == 202100 || __OPENCL_C_VERSION__ == 300)
// For the SPIR and SPIR-V target all features are supported.
#if defined(__SPIR__) || defined(__SPIRV__)
+#define __opencl_c_atomic_order_seq_cst 1
+#define __opencl_c_atomic_scope_device 1
#define __opencl_c_atomic_scope_all_devices 1
#define __opencl_c_read_write_images 1
#endif // defined(__SPIR__)
diff --git a/contrib/llvm-project/clang/lib/Headers/opencl-c.h b/contrib/llvm-project/clang/lib/Headers/opencl-c.h
index 059a2ec2371b..c7bb77716ac4 100644
--- a/contrib/llvm-project/clang/lib/Headers/opencl-c.h
+++ b/contrib/llvm-project/clang/lib/Headers/opencl-c.h
@@ -13832,6 +13832,7 @@ float __ovld atomic_fetch_max_explicit(volatile atomic_float *object,
#endif // defined(__opencl_c_ext_fp32_global_atomic_min_max) && \
defined(__opencl_c_ext_fp32_local_atomic_min_max)
+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
#if defined(__opencl_c_ext_fp64_global_atomic_min_max)
double __ovld atomic_fetch_min(volatile __global atomic_double *object,
double operand);
@@ -13882,6 +13883,8 @@ double __ovld atomic_fetch_max_explicit(volatile atomic_double *object,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp64_global_atomic_min_max) && \
defined(__opencl_c_ext_fp64_local_atomic_min_max)
+#endif // defined(cl_khr_int64_base_atomics) && \
+ defined(cl_khr_int64_extended_atomics)
#if defined(__opencl_c_ext_fp16_global_atomic_add)
half __ovld atomic_fetch_add(volatile __global atomic_half *object,
@@ -13985,6 +13988,7 @@ float __ovld atomic_fetch_sub_explicit(volatile atomic_float *object,
#endif // defined(__opencl_c_ext_fp32_global_atomic_add) && \
defined(__opencl_c_ext_fp32_local_atomic_add)
+#if defined(cl_khr_int64_base_atomics) && defined(cl_khr_int64_extended_atomics)
#if defined(__opencl_c_ext_fp64_global_atomic_add)
double __ovld atomic_fetch_add(volatile __global atomic_double *object,
double operand);
@@ -14035,6 +14039,8 @@ double __ovld atomic_fetch_sub_explicit(volatile atomic_double *object,
memory_scope scope);
#endif // defined(__opencl_c_ext_fp64_global_atomic_add) && \
defined(__opencl_c_ext_fp64_local_atomic_add)
+#endif // defined(cl_khr_int64_base_atomics) && \
+ defined(cl_khr_int64_extended_atomics)
#endif // cl_ext_float_atomics
diff --git a/contrib/llvm-project/clang/lib/Headers/ppc_wrappers/mm_malloc.h b/contrib/llvm-project/clang/lib/Headers/ppc_wrappers/mm_malloc.h
index 86cf1a0f7618..b6bf22f92887 100644
--- a/contrib/llvm-project/clang/lib/Headers/ppc_wrappers/mm_malloc.h
+++ b/contrib/llvm-project/clang/lib/Headers/ppc_wrappers/mm_malloc.h
@@ -19,7 +19,7 @@
#ifndef __cplusplus
extern int posix_memalign (void **, size_t, size_t);
#else
-extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+extern "C" int posix_memalign (void **, size_t, size_t);
#endif
static __inline void *
diff --git a/contrib/llvm-project/clang/lib/Sema/OpenCLBuiltins.td b/contrib/llvm-project/clang/lib/Sema/OpenCLBuiltins.td
index cd704ba2df13..ab3055300572 100644
--- a/contrib/llvm-project/clang/lib/Sema/OpenCLBuiltins.td
+++ b/contrib/llvm-project/clang/lib/Sema/OpenCLBuiltins.td
@@ -57,6 +57,23 @@ class FunctionExtension<string _Ext> : AbstractExtension<_Ext>;
// disabled.
class TypeExtension<string _Ext> : AbstractExtension<_Ext>;
+// Concatenate zero or more space-separated extensions in NewExts to Base and
+// return the resulting FunctionExtension in ret.
+class concatExtension<FunctionExtension Base, string NewExts> {
+ FunctionExtension ret = FunctionExtension<
+ !cond(
+ // Return Base extension if NewExts is empty,
+ !empty(NewExts) : Base.ExtName,
+
+ // otherwise, return NewExts if Base extension is empty,
+ !empty(Base.ExtName) : NewExts,
+
+ // otherwise, concatenate NewExts to Base.
+ true : Base.ExtName # " " # NewExts
+ )
+ >;
+}
+
// TypeExtension definitions.
def NoTypeExt : TypeExtension<"">;
def Fp16TypeExt : TypeExtension<"cl_khr_fp16">;
@@ -90,27 +107,27 @@ def FuncExtOpenCLCNamedAddressSpaceBuiltins : FunctionExtension<"__opencl_c_name
def FuncExtOpenCLCPipes : FunctionExtension<"__opencl_c_pipes">;
def FuncExtOpenCLCWGCollectiveFunctions : FunctionExtension<"__opencl_c_work_group_collective_functions">;
def FuncExtOpenCLCReadWriteImages : FunctionExtension<"__opencl_c_read_write_images">;
-def FuncExtFloatAtomicsFp16GlobalLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_load_store">;
-def FuncExtFloatAtomicsFp16LocalLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_load_store">;
-def FuncExtFloatAtomicsFp16GenericLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_load_store __opencl_c_ext_fp16_local_atomic_load_store">;
-def FuncExtFloatAtomicsFp16GlobalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_add">;
-def FuncExtFloatAtomicsFp32GlobalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_global_atomic_add">;
-def FuncExtFloatAtomicsFp64GlobalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_global_atomic_add">;
-def FuncExtFloatAtomicsFp16LocalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_add">;
-def FuncExtFloatAtomicsFp32LocalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_add">;
-def FuncExtFloatAtomicsFp64LocalAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_add">;
-def FuncExtFloatAtomicsFp16GenericAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_add __opencl_c_ext_fp16_global_atomic_add">;
-def FuncExtFloatAtomicsFp32GenericAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_add __opencl_c_ext_fp32_global_atomic_add">;
-def FuncExtFloatAtomicsFp64GenericAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_add __opencl_c_ext_fp64_global_atomic_add">;
-def FuncExtFloatAtomicsFp16GlobalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_min_max">;
-def FuncExtFloatAtomicsFp32GlobalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_global_atomic_min_max">;
-def FuncExtFloatAtomicsFp64GlobalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_global_atomic_min_max">;
-def FuncExtFloatAtomicsFp16LocalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_min_max">;
-def FuncExtFloatAtomicsFp32LocalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_min_max">;
-def FuncExtFloatAtomicsFp64LocalMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_min_max">;
-def FuncExtFloatAtomicsFp16GenericMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_min_max __opencl_c_ext_fp16_global_atomic_min_max">;
-def FuncExtFloatAtomicsFp32GenericMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_min_max __opencl_c_ext_fp32_global_atomic_min_max">;
-def FuncExtFloatAtomicsFp64GenericMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_min_max __opencl_c_ext_fp64_global_atomic_min_max">;
+def FuncExtFloatAtomicsFp16GlobalASLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_load_store">;
+def FuncExtFloatAtomicsFp16LocalASLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_load_store">;
+def FuncExtFloatAtomicsFp16GenericASLoadStore : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_load_store __opencl_c_ext_fp16_local_atomic_load_store">;
+def FuncExtFloatAtomicsFp16GlobalASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_add">;
+def FuncExtFloatAtomicsFp32GlobalASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_global_atomic_add">;
+def FuncExtFloatAtomicsFp64GlobalASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_global_atomic_add">;
+def FuncExtFloatAtomicsFp16LocalASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_add">;
+def FuncExtFloatAtomicsFp32LocalASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_add">;
+def FuncExtFloatAtomicsFp64LocalASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_add">;
+def FuncExtFloatAtomicsFp16GenericASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_add __opencl_c_ext_fp16_global_atomic_add">;
+def FuncExtFloatAtomicsFp32GenericASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_add __opencl_c_ext_fp32_global_atomic_add">;
+def FuncExtFloatAtomicsFp64GenericASAdd : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_add __opencl_c_ext_fp64_global_atomic_add">;
+def FuncExtFloatAtomicsFp16GlobalASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_global_atomic_min_max">;
+def FuncExtFloatAtomicsFp32GlobalASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_global_atomic_min_max">;
+def FuncExtFloatAtomicsFp64GlobalASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_global_atomic_min_max">;
+def FuncExtFloatAtomicsFp16LocalASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_min_max">;
+def FuncExtFloatAtomicsFp32LocalASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_min_max">;
+def FuncExtFloatAtomicsFp64LocalASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_min_max">;
+def FuncExtFloatAtomicsFp16GenericASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp16_local_atomic_min_max __opencl_c_ext_fp16_global_atomic_min_max">;
+def FuncExtFloatAtomicsFp32GenericASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp32_local_atomic_min_max __opencl_c_ext_fp32_global_atomic_min_max">;
+def FuncExtFloatAtomicsFp64GenericASMinMax : FunctionExtension<"cl_ext_float_atomics __opencl_c_ext_fp64_local_atomic_min_max __opencl_c_ext_fp64_global_atomic_min_max">;
// Not a real extension, but a workaround to add C++ for OpenCL specific builtins.
def FuncExtOpenCLCxx : FunctionExtension<"__cplusplus">;
@@ -1041,42 +1058,59 @@ let Extension = FuncExtOpenCLCxx in {
}
// OpenCL v2.0 s6.13.11 - Atomic Functions.
-let MinVersion = CL20 in {
- def : Builtin<"atomic_work_item_fence", [Void, MemFenceFlags, MemoryOrder, MemoryScope]>;
+// An atomic builtin with 2 additional _explicit variants.
+multiclass BuiltinAtomicExplicit<string Name, list<Type> Types, FunctionExtension BaseExt> {
+ // Without explicit MemoryOrder or MemoryScope.
+ let Extension = concatExtension<BaseExt, "__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device">.ret in {
+ def : Builtin<Name, Types>;
+ }
+
+ // With an explicit MemoryOrder argument.
+ let Extension = concatExtension<BaseExt, "__opencl_c_atomic_scope_device">.ret in {
+ def : Builtin<Name # "_explicit", !listconcat(Types, [MemoryOrder])>;
+ }
+
+ // With explicit MemoryOrder and MemoryScope arguments.
+ let Extension = BaseExt in {
+ def : Builtin<Name # "_explicit", !listconcat(Types, [MemoryOrder, MemoryScope])>;
+ }
+}
+
+// OpenCL 2.0 atomic functions that have a pointer argument in a given address space.
+multiclass OpenCL2Atomics<AddressSpace addrspace, FunctionExtension BaseExt> {
foreach TypePair = [[AtomicInt, Int], [AtomicUInt, UInt],
[AtomicLong, Long], [AtomicULong, ULong],
[AtomicFloat, Float], [AtomicDouble, Double]] in {
def : Builtin<"atomic_init",
- [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
- def : Builtin<"atomic_store",
- [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
- def : Builtin<"atomic_store_explicit",
- [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1], MemoryOrder]>;
- def : Builtin<"atomic_store_explicit",
- [Void, PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1], MemoryOrder, MemoryScope]>;
- def : Builtin<"atomic_load",
- [TypePair[1], PointerType<VolatileType<TypePair[0]>, GenericAS>]>;
- def : Builtin<"atomic_load_explicit",
- [TypePair[1], PointerType<VolatileType<TypePair[0]>, GenericAS>, MemoryOrder]>;
- def : Builtin<"atomic_load_explicit",
- [TypePair[1], PointerType<VolatileType<TypePair[0]>, GenericAS>, MemoryOrder, MemoryScope]>;
- def : Builtin<"atomic_exchange",
- [TypePair[1], PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1]]>;
- def : Builtin<"atomic_exchange_explicit",
- [TypePair[1], PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1], MemoryOrder]>;
- def : Builtin<"atomic_exchange_explicit",
- [TypePair[1], PointerType<VolatileType<TypePair[0]>, GenericAS>, TypePair[1], MemoryOrder, MemoryScope]>;
+ [Void, PointerType<VolatileType<TypePair[0]>, addrspace>, TypePair[1]]>;
+ defm : BuiltinAtomicExplicit<"atomic_store",
+ [Void, PointerType<VolatileType<TypePair[0]>, addrspace>, TypePair[1]], BaseExt>;
+ defm : BuiltinAtomicExplicit<"atomic_load",
+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, addrspace>], BaseExt>;
+ defm : BuiltinAtomicExplicit<"atomic_exchange",
+ [TypePair[1], PointerType<VolatileType<TypePair[0]>, addrspace>, TypePair[1]], BaseExt>;
foreach Variant = ["weak", "strong"] in {
- def : Builtin<"atomic_compare_exchange_" # Variant,
- [Bool, PointerType<VolatileType<TypePair[0]>, GenericAS>,
- PointerType<TypePair[1], GenericAS>, TypePair[1]]>;
- def : Builtin<"atomic_compare_exchange_" # Variant # "_explicit",
- [Bool, PointerType<VolatileType<TypePair[0]>, GenericAS>,
- PointerType<TypePair[1], GenericAS>, TypePair[1], MemoryOrder, MemoryOrder]>;
- def : Builtin<"atomic_compare_exchange_" # Variant # "_explicit",
- [Bool, PointerType<VolatileType<TypePair[0]>, GenericAS>,
- PointerType<TypePair[1], GenericAS>, TypePair[1], MemoryOrder, MemoryOrder, MemoryScope]>;
+ foreach exp_ptr_addrspace = !cond(
+ !eq(BaseExt, FuncExtOpenCLCGenericAddressSpace): [GenericAS],
+ !eq(BaseExt, FuncExtOpenCLCNamedAddressSpaceBuiltins): [GlobalAS, LocalAS, PrivateAS])
+ in {
+ let Extension = concatExtension<BaseExt, "__opencl_c_atomic_order_seq_cst __opencl_c_atomic_scope_device">.ret in {
+ def : Builtin<"atomic_compare_exchange_" # Variant,
+ [Bool, PointerType<VolatileType<TypePair[0]>, addrspace>,
+ PointerType<TypePair[1], exp_ptr_addrspace>, TypePair[1]]>;
+ }
+ let Extension = concatExtension<BaseExt, "__opencl_c_atomic_scope_device">.ret in {
+ def : Builtin<"atomic_compare_exchange_" # Variant # "_explicit",
+ [Bool, PointerType<VolatileType<TypePair[0]>, addrspace>,
+ PointerType<TypePair[1], exp_ptr_addrspace>, TypePair[1], MemoryOrder, MemoryOrder]>;
+ }
+ let Extension = BaseExt in {
+ def : Builtin<"atomic_compare_exchange_" # Variant # "_explicit",
+ [Bool, PointerType<VolatileType<TypePair[0]>, addrspace>,
+ PointerType<TypePair[1], exp_ptr_addrspace>, TypePair[1], MemoryOrder, MemoryOrder, MemoryScope]>;
+ }
+ }
}
}
@@ -1084,249 +1118,69 @@ let MinVersion = CL20 in {
[AtomicLong, Long, Long], [AtomicULong, ULong, ULong],
*** 7519 LINES SKIPPED ***