From 63d9dcdd7e821923f1df350ad381f3e432c3de06 Mon Sep 17 00:00:00 2001 From: Yury Bura Date: Thu, 6 Jun 2024 01:14:30 -0700 Subject: [PATCH] [llvm] Update to 18.1.6 (#37599) Fixes #37189 - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [x] SHA512s are updated for each updated download. - [x] The "supports" clause reflects platforms that may be fixed by this new version. - [x] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file. - [x] Any patches that are no longer applied are deleted from the port's directory. - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file. --- ports/halide/portfile.cmake | 4 +- ports/halide/vcpkg.json | 1 + ports/llvm/0002-fix-tools-install-dir.patch | 56 +- ports/llvm/0003-fix-llvm-config.patch | 2 +- .../llvm/0007-fix-compiler-rt-warnings.patch | 45 - ports/llvm/0008-add-missing-case.patch | 71 - ports/llvm/0009-add-missing-typename.patch | 13 - ports/llvm/75711.patch | 1350 +++++++++++++++++ ports/llvm/79694.patch | 217 +++ ports/llvm/82407.patch | 112 ++ ports/llvm/portfile.cmake | 48 +- ports/llvm/vcpkg.json | 3 +- ...ver-llvm-move-to-modern-pass-manager.patch | 127 -- .../mesa/gallium-fix-build-with-llvm-17.patch | 42 - ports/mesa/portfile.cmake | 35 +- ports/mesa/vcpkg.json | 42 +- ports/symengine/portfile.cmake | 4 +- ports/symengine/vcpkg.json | 1 + scripts/ci.baseline.txt | 1 + scripts/test_ports/vcpkg-ci-llvm/vcpkg.json | 2 +- versions/baseline.json | 12 +- versions/h-/halide.json | 5 + versions/l-/llvm.json | 5 + versions/m-/mesa.json | 5 + versions/s-/symengine.json | 5 + 25 files changed, 1788 insertions(+), 420 deletions(-) delete mode 100644 ports/llvm/0007-fix-compiler-rt-warnings.patch delete mode 100644 ports/llvm/0008-add-missing-case.patch delete mode 100644 ports/llvm/0009-add-missing-typename.patch create mode 100644 ports/llvm/75711.patch create mode 100644 ports/llvm/79694.patch create mode 100644 ports/llvm/82407.patch delete mode 100644 ports/mesa/clover-llvm-move-to-modern-pass-manager.patch delete mode 100644 ports/mesa/gallium-fix-build-with-llvm-17.patch diff --git a/ports/halide/portfile.cmake b/ports/halide/portfile.cmake index 5b900593f2..5065420e46 100644 --- a/ports/halide/portfile.cmake +++ b/ports/halide/portfile.cmake @@ -3,8 +3,8 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO halide/Halide - REF "v${VERSION}" - SHA512 fd94b35d0af2bbb4e932c6be5204c8a4bf011a9c62bcfc2115d263b269438bb5858627492c108c17140ccf872317f072619b59b6f583fed1bec001af53b8c0e2 + REF 8864e8ac1c0bb460f0034e9c46f7f944afad3a19 # unreleased version with LLVM 18 support + SHA512 286cbef25b5cc0f5095cbc80a2fd1cacf369948c58c14406ac6bcc28a7a37c81417d601975083f03670e22276a1886b8801bdc91aa6fe80049a276a1c8fd08b9 HEAD_REF main ) diff --git a/ports/halide/vcpkg.json b/ports/halide/vcpkg.json index f60631026d..70e2f528d8 100644 --- a/ports/halide/vcpkg.json +++ b/ports/halide/vcpkg.json @@ -1,6 +1,7 @@ { "name": "halide", "version": "17.0.1", + "port-version": 1, "description": "Halide is a programming language designed to make it easier to write high-performance image and array processing code on modern machines.", "homepage": "https://github.com/halide/Halide", "license": "MIT", diff --git a/ports/llvm/0002-fix-tools-install-dir.patch b/ports/llvm/0002-fix-tools-install-dir.patch index 4d0e5710a7..93d4bb3090 100644 --- a/ports/llvm/0002-fix-tools-install-dir.patch +++ b/ports/llvm/0002-fix-tools-install-dir.patch @@ -11,9 +11,8 @@ flang/tools/f18/CMakeLists.txt | 2 +- flang/tools/flang-driver/CMakeLists.txt | 2 +- lld/cmake/modules/AddLLD.cmake | 2 +- - lld/tools/lld/CMakeLists.txt | 2 +- lldb/cmake/modules/AddLLDB.cmake | 2 +- - 15 files changed, 16 insertions(+), 16 deletions(-) + 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bolt/cmake/modules/AddBOLT.cmake b/bolt/cmake/modules/AddBOLT.cmake index 1f69b9046320..b0de5186dde4 100644 @@ -29,10 +28,10 @@ index 1f69b9046320..b0de5186dde4 100644 if(NOT LLVM_ENABLE_IDE) diff --git a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt -index 3ce552872015..ce5a899ebe6d 100644 +index b220cbea80f1..b94501ec82ab 100644 --- a/clang-tools-extra/clang-tidy/tool/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/tool/CMakeLists.txt -@@ -64,6 +64,6 @@ install(PROGRAMS clang-tidy-diff.py +@@ -65,6 +65,6 @@ install(PROGRAMS clang-tidy-diff.py DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-tidy) install(PROGRAMS run-clang-tidy.py @@ -41,10 +40,10 @@ index 3ce552872015..ce5a899ebe6d 100644 COMPONENT clang-tidy RENAME run-clang-tidy) diff --git a/clang-tools-extra/modularize/CMakeLists.txt b/clang-tools-extra/modularize/CMakeLists.txt -index 28635ca1089d..4516c8fb7ad0 100644 +index eb5383c3ad44..39a34dfe8c71 100644 --- a/clang-tools-extra/modularize/CMakeLists.txt +++ b/clang-tools-extra/modularize/CMakeLists.txt -@@ -24,5 +24,5 @@ clang_target_link_libraries(modularize +@@ -27,5 +27,5 @@ clang_target_link_libraries(modularize ) install(TARGETS modularize @@ -78,16 +77,18 @@ index 0ae1b4e55244..7774cd27afcd 100644 install(TARGETS c-index-test diff --git a/clang/tools/clang-format/CMakeLists.txt b/clang/tools/clang-format/CMakeLists.txt -index 30c93f8667c8..5c6f87f62e8e 100644 +index 1c61a3c8fb80..4220d90274bd 100644 --- a/clang/tools/clang-format/CMakeLists.txt +++ b/clang/tools/clang-format/CMakeLists.txt -@@ -36,5 +36,5 @@ install(FILES clang-format.py +@@ -36,7 +36,7 @@ install(FILES clang-format.py DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-format) install(PROGRAMS git-clang-format - DESTINATION "${CMAKE_INSTALL_BINDIR}" + DESTINATION "${CLANG_TOOLS_INSTALL_DIR}" COMPONENT clang-format) + + if (WIN32 AND NOT CYGWIN) diff --git a/clang/tools/scan-build-py/CMakeLists.txt b/clang/tools/scan-build-py/CMakeLists.txt index 3aca22c0b0a8..a8283219c99f 100644 --- a/clang/tools/scan-build-py/CMakeLists.txt @@ -150,10 +151,10 @@ index 41ce8738e7bf..d9659c4cf53a 100644 if(NOT LLVM_ENABLE_IDE) diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt -index d7538feef121..ec8b7737ee22 100644 +index ba6c6642c0b6..ab2802aeeaaa 100644 --- a/flang/tools/f18/CMakeLists.txt +++ b/flang/tools/f18/CMakeLists.txt -@@ -75,7 +75,7 @@ if (NOT WIN32) +@@ -83,7 +83,7 @@ if (NOT WIN32) @ONLY ) add_custom_target(flang-to-external-fc ALL DEPENDS ${CMAKE_BINARY_DIR}/bin/flang-to-external-fc) @@ -173,36 +174,23 @@ index 3ce8b407450d..6b2e2b0dc33a 100644 -install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}") +install(TARGETS flang-new DESTINATION "${FLANG_TOOLS_INSTALL_DIR}") diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake -index d3924f7243d4..318b41b73705 100644 +index 2ee066b41535..c6a4740ab9eb 100644 --- a/lld/cmake/modules/AddLLD.cmake +++ b/lld/cmake/modules/AddLLD.cmake -@@ -47,7 +47,7 @@ macro(add_lld_tool name) - get_target_export_arg(${name} LLD export_to_lldtargets) - install(TARGETS ${name} - ${export_to_lldtargets} -- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" -+ RUNTIME DESTINATION "${LLD_TOOLS_INSTALL_DIR}" - COMPONENT ${name}) +@@ -56,7 +56,7 @@ macro(add_lld_tool name) + get_target_export_arg(${name} LLD export_to_lldtargets) + install(TARGETS ${name} + ${export_to_lldtargets} +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ RUNTIME DESTINATION "${LLD_TOOLS_INSTALL_DIR}" + COMPONENT ${name}) - if(NOT CMAKE_CONFIGURATION_TYPES) -diff --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt -index 12628395680b..ee58ed439a3a 100644 ---- a/lld/tools/lld/CMakeLists.txt -+++ b/lld/tools/lld/CMakeLists.txt -@@ -29,7 +29,7 @@ lld_target_link_libraries(lld - ) - - install(TARGETS lld -- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") -+ RUNTIME DESTINATION "${LLD_TOOLS_INSTALL_DIR}") - - if(NOT LLD_SYMLINKS_TO_CREATE) - set(LLD_SYMLINKS_TO_CREATE + if(NOT CMAKE_CONFIGURATION_TYPES) diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake -index d47a30f5e109..f0bbc0e50627 100644 +index 328e883ddbe5..86eebba45e01 100644 --- a/lldb/cmake/modules/AddLLDB.cmake +++ b/lldb/cmake/modules/AddLLDB.cmake -@@ -216,7 +216,7 @@ function(add_lldb_executable name) +@@ -221,7 +221,7 @@ function(add_lldb_executable name) endif() if(ARG_GENERATE_INSTALL) diff --git a/ports/llvm/0003-fix-llvm-config.patch b/ports/llvm/0003-fix-llvm-config.patch index e1231d578d..568cb17cbb 100644 --- a/ports/llvm/0003-fix-llvm-config.patch +++ b/ports/llvm/0003-fix-llvm-config.patch @@ -2,7 +2,7 @@ 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp -index e86eb2b44b10..04e00944f891 100644 +index d5b76b1bb6c1..9fedcb2ab75f 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -304,7 +304,7 @@ int main(int argc, char **argv) { diff --git a/ports/llvm/0007-fix-compiler-rt-warnings.patch b/ports/llvm/0007-fix-compiler-rt-warnings.patch deleted file mode 100644 index 67ce0079b4..0000000000 --- a/ports/llvm/0007-fix-compiler-rt-warnings.patch +++ /dev/null @@ -1,45 +0,0 @@ - compiler-rt/lib/asan/CMakeLists.txt | 2 +- - compiler-rt/lib/interception/CMakeLists.txt | 2 +- - compiler-rt/lib/ubsan/CMakeLists.txt | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt -index 1bfc6f0c5e37..f35c385c379a 100644 ---- a/compiler-rt/lib/asan/CMakeLists.txt -+++ b/compiler-rt/lib/asan/CMakeLists.txt -@@ -92,7 +92,7 @@ append_rtti_flag(OFF ASAN_CFLAGS) - - # Silence warnings in system headers with MSVC. - if(NOT CLANG_CL) -- append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external /external:W0 /external:anglebrackets" ASAN_CFLAGS) -+ append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external;/external:W0;/external:anglebrackets" ASAN_CFLAGS) - endif() - - # Too many existing bugs, needs cleanup. -diff --git a/compiler-rt/lib/interception/CMakeLists.txt b/compiler-rt/lib/interception/CMakeLists.txt -index 3242cf50e35f..abe9229340be 100644 ---- a/compiler-rt/lib/interception/CMakeLists.txt -+++ b/compiler-rt/lib/interception/CMakeLists.txt -@@ -21,7 +21,7 @@ append_rtti_flag(OFF INTERCEPTION_CFLAGS) - - # Silence warnings in system headers with MSVC. - if(NOT CLANG_CL) -- append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external /external:W0 /external:anglebrackets" INTERCEPTION_CFLAGS) -+ append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external;/external:W0;/external:anglebrackets" INTERCEPTION_CFLAGS) - endif() - - add_compiler_rt_object_libraries(RTInterception -diff --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt -index 520a024fbede..75b0b12b9da2 100644 ---- a/compiler-rt/lib/ubsan/CMakeLists.txt -+++ b/compiler-rt/lib/ubsan/CMakeLists.txt -@@ -57,7 +57,7 @@ append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CXXFLAGS) - - # Silence warnings in system headers with MSVC. - if(NOT CLANG_CL) -- append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external /external:W0 /external:anglebrackets" UBSAN_CXXFLAGS) -+ append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external;/external:W0;/external:anglebrackets" UBSAN_CXXFLAGS) - endif() - - set(UBSAN_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS}) - \ No newline at end of file diff --git a/ports/llvm/0008-add-missing-case.patch b/ports/llvm/0008-add-missing-case.patch deleted file mode 100644 index 2ed29c34e2..0000000000 --- a/ports/llvm/0008-add-missing-case.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp -index b5d29b2e9..b4fc088a1 100644 ---- a/clang/lib/Sema/SemaCodeComplete.cpp -+++ b/clang/lib/Sema/SemaCodeComplete.cpp -@@ -4088,6 +4088,9 @@ CXCursorKind clang::getCursorKindForDecl(const Decl *D) { - case Decl::Concept: - return CXCursor_ConceptDecl; - -+ case Decl::LinkageSpec: -+ return CXCursor_LinkageSpec; -+ - default: - if (const auto *TD = dyn_cast(D)) { - switch (TD->getTagKind()) { -diff --git a/clang/test/Index/recursive-cxx-member-calls.cpp b/clang/test/Index/recursive-cxx-member-calls.cpp -index 09f3f4141..be908c506 100644 ---- a/clang/test/Index/recursive-cxx-member-calls.cpp -+++ b/clang/test/Index/recursive-cxx-member-calls.cpp -@@ -216,9 +216,9 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { - // CHECK-tokens: Punctuation: "}" [4:63 - 4:64] ClassTemplate=pair:4:44 (Definition) - // CHECK-tokens: Punctuation: ";" [4:64 - 4:65] Namespace=std:3:11 (Definition) - // CHECK-tokens: Punctuation: "}" [5:1 - 5:2] Namespace=std:3:11 (Definition) --// CHECK-tokens: Keyword: "extern" [6:1 - 6:7] --// CHECK-tokens: Literal: ""C"" [6:8 - 6:11] UnexposedDecl=:6:8 (Definition) --// CHECK-tokens: Punctuation: "{" [6:12 - 6:13] UnexposedDecl=:6:8 (Definition) -+// CHECK-tokens: Keyword: "extern" [6:1 - 6:7] LinkageSpec=:6:8 (Definition) -+// CHECK-tokens: Literal: ""C"" [6:8 - 6:11] LinkageSpec=:6:8 (Definition) -+// CHECK-tokens: Punctuation: "{" [6:12 - 6:13] LinkageSpec=:6:8 (Definition) - // CHECK-tokens: Keyword: "int" [7:3 - 7:6] FunctionDecl=memcmp:7:7 - // CHECK-tokens: Identifier: "memcmp" [7:7 - 7:13] FunctionDecl=memcmp:7:7 - // CHECK-tokens: Punctuation: "(" [7:13 - 7:14] FunctionDecl=memcmp:7:7 -@@ -232,7 +232,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { - // CHECK-tokens: Punctuation: "," [7:40 - 7:41] FunctionDecl=memcmp:7:7 - // CHECK-tokens: Identifier: "size_t" [7:42 - 7:48] TypeRef=size_t:2:25 - // CHECK-tokens: Punctuation: ")" [7:48 - 7:49] FunctionDecl=memcmp:7:7 --// CHECK-tokens: Punctuation: ";" [7:49 - 7:50] UnexposedDecl=:6:8 (Definition) -+// CHECK-tokens: Punctuation: ";" [7:49 - 7:50] LinkageSpec=:6:8 (Definition) - // CHECK-tokens: Identifier: "size_t" [8:3 - 8:9] TypeRef=size_t:2:25 - // CHECK-tokens: Identifier: "strlen" [8:10 - 8:16] FunctionDecl=strlen:8:10 - // CHECK-tokens: Punctuation: "(" [8:16 - 8:17] FunctionDecl=strlen:8:10 -@@ -1532,7 +1532,7 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo * Name) { - // CHECK: 4:20: TemplateTypeParameter=_T1:4:20 (Definition) Extent=[4:14 - 4:23] - // CHECK: 4:31: TemplateTypeParameter=_T2:4:31 (Definition) Extent=[4:25 - 4:34] - // CHECK: 4:55: FieldDecl=second:4:55 (Definition) Extent=[4:51 - 4:61] --// CHECK: 6:8: UnexposedDecl=:6:8 (Definition) Extent=[6:1 - 9:2] -+// CHECK: 6:8: LinkageSpec=:6:8 (Definition) Extent=[6:1 - 9:2] - // CHECK: 7:7: FunctionDecl=memcmp:7:7 Extent=[7:3 - 7:49] - // CHECK: 7:26: ParmDecl=:7:26 (Definition) Extent=[7:14 - 7:26] - // CHECK: 7:40: ParmDecl=:7:40 (Definition) Extent=[7:28 - 7:40] -diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c -index 9d66a22f3..2c0c9cb8e 100644 ---- a/clang/tools/c-index-test/c-index-test.c -+++ b/clang/tools/c-index-test/c-index-test.c -@@ -1838,6 +1838,8 @@ static enum CXChildVisitResult PrintMangledName(CXCursor cursor, CXCursor p, - CXString MangledName; - if (clang_isUnexposed(clang_getCursorKind(cursor))) - return CXChildVisit_Recurse; -+ if (clang_getCursorKind(cursor) == CXCursor_LinkageSpec) -+ return CXChildVisit_Recurse; - PrintCursor(cursor, NULL); - MangledName = clang_Cursor_getMangling(cursor); - printf(" [mangled=%s]\n", clang_getCString(MangledName)); -@@ -1853,6 +1855,8 @@ static enum CXChildVisitResult PrintManglings(CXCursor cursor, CXCursor p, - return CXChildVisit_Recurse; - if (!clang_isDeclaration(clang_getCursorKind(cursor))) - return CXChildVisit_Recurse; -+ if (clang_getCursorKind(cursor) == CXCursor_LinkageSpec) -+ return CXChildVisit_Recurse; - if (clang_getCursorKind(cursor) == CXCursor_ParmDecl) - return CXChildVisit_Continue; - PrintCursor(cursor, NULL); diff --git a/ports/llvm/0009-add-missing-typename.patch b/ports/llvm/0009-add-missing-typename.patch deleted file mode 100644 index 50fd603d7f..0000000000 --- a/ports/llvm/0009-add-missing-typename.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp -index 4b281d5f1..0a008ab9b 100644 ---- a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp -+++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp -@@ -951,7 +951,7 @@ std::vector< - DwarfLinkerForBinary::AddressManager::getRelocations( - const std::vector &Relocs, uint64_t StartPos, uint64_t EndPos) { - std::vector< -- DwarfLinkerForBinary::AddressManager::ValidReloc> -+ typename DwarfLinkerForBinary::AddressManager::ValidReloc> - Res; - - auto CurReloc = partition_point(Relocs, [StartPos](const ValidReloc &Reloc) { diff --git a/ports/llvm/75711.patch b/ports/llvm/75711.patch new file mode 100644 index 0000000000..15287efea8 --- /dev/null +++ b/ports/llvm/75711.patch @@ -0,0 +1,1350 @@ +From afec08ef9f1015ea3fe8d67b92acfbb7837c6e9f Mon Sep 17 00:00:00 2001 +From: Max Winkler +Date: Tue, 19 Mar 2024 08:30:54 -0400 +Subject: [PATCH] [clang] Add `intrin0.h` header to mimic `intrin0.h` used by + MSVC STL for clang-cl (#75711) + +Fixes https://github.com/llvm/llvm-project/issues/53520. + +#### Description #### + +Provide `intrin0.h` to be the minimal set of intrinsics that the MSVC +STL requires. +The `intrin0.h` header matches the latest header provided by MSVC 1939 +which does include some extra intrinsics that the MSVC STL does not use. + +Inside `BuiltinHeaders.def` I kept the header description as `intrin.h`. +If you want me to change those to `intrin0.h` for the moved intrinsics +let me know. + +This should now allow `immintrin.h` to be used with function targets for +runtime cpu detection of simd instruction sets without worrying about +the compile-time overhead from MSVC STL including `intrin.h` on clang. + +I still need to figure out how to best update MSVC STL to detect for the +presence of `intrin0.h` from clang and to use this header over +`intrin.h`. + +#### Testing #### + +Built clang locally and ran the test suite. I still need to do a pass +over the existing unit tests for the ms intrinsics to make sure there +aren't any gaps. Wanted to get this PR up for discussion first. + +Modified latest MSVC STL from github to point to `intrin0.h` for clang. + +Wrote some test files that included MSVC STL headers that rely on +intrinsics such as `atomic`, `bit` and `vector`. Built the unit tests +against x86, arm, aarch64, and x64. + +#### Benchmarks #### + +The following include times are based on the x64 target with the +modified headers in this PR. +These timings were done by using `clang-cl.exe -ftime-trace` and taking +the wall time for parsing `intrin.h` and `intrin0.h`. + +`intrin.h` takes ~897ms to parse. +`intrin0.h` takes ~1ms to parse. + +If there is anything required or a different approach is preferred let +me know. I would very much like to move this over the finish line so we +can use function targets with clang-cl. +--- + clang/lib/Headers/CMakeLists.txt | 2 + + clang/lib/Headers/bmiintrin.h | 6 +- + clang/lib/Headers/immintrin.h | 240 ++++++++++----------------- + clang/lib/Headers/intrin.h | 217 +----------------------- + clang/lib/Headers/intrin0.h | 247 ++++++++++++++++++++++++++++ + clang/lib/Headers/keylockerintrin.h | 13 +- + clang/lib/Headers/x86gprintrin.h | 21 +-- + clang/lib/Headers/x86intrin.h | 30 ++-- + clang/lib/Headers/yvals_core.h | 25 +++ + 10 files changed, 408 insertions(+), 413 deletions(-) + create mode 100644 clang/lib/Headers/intrin0.h + create mode 100644 clang/lib/Headers/yvals_core.h + +diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt +index 902e33bb95897c..97104ccd8db59c 100644 +--- a/clang/lib/Headers/CMakeLists.txt ++++ b/clang/lib/Headers/CMakeLists.txt +@@ -254,8 +254,10 @@ set(x86_files + ) + + set(windows_only_files ++ intrin0.h + intrin.h + vadefs.h ++ yvals_core.h + ) + + set(utility_files +diff --git a/clang/lib/Headers/bmiintrin.h b/clang/lib/Headers/bmiintrin.h +index d8e57c0cb49404..78bffe68e221a9 100644 +--- a/clang/lib/Headers/bmiintrin.h ++++ b/clang/lib/Headers/bmiintrin.h +@@ -161,8 +161,7 @@ _mm_tzcnt_64(unsigned long long __X) + + #undef __RELAXED_FN_ATTRS + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__BMI__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__BMI__) + + /* Define the default attributes for the functions in this file. */ + #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("bmi"))) +@@ -610,7 +609,6 @@ __blsr_u64(unsigned long long __X) + + #undef __DEFAULT_FN_ATTRS + +-#endif /* !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) \ +- || defined(__BMI__) */ ++#endif /* !defined(__SCE__) || __has_feature(modules) || defined(__BMI__) */ + + #endif /* __BMIINTRIN_H */ +diff --git a/clang/lib/Headers/immintrin.h b/clang/lib/Headers/immintrin.h +index 27800f7a8202c1..508696d3725b9a 100644 +--- a/clang/lib/Headers/immintrin.h ++++ b/clang/lib/Headers/immintrin.h +@@ -16,281 +16,239 @@ + + #include + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__MMX__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__MMX__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SSE__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SSE__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SSE2__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SSE2__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SSE3__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SSE3__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SSSE3__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SSSE3__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__SSE4_2__) || defined(__SSE4_1__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AES__) || defined(__PCLMUL__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__CLFLUSHOPT__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__CLFLUSHOPT__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__CLWB__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__CLWB__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX2__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX2__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__F16C__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__F16C__) + #include + #endif + + /* No feature check desired due to internal checks */ + #include + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__BMI2__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__BMI2__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__LZCNT__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__LZCNT__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__POPCNT__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__POPCNT__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__FMA__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__FMA__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512F__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512F__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512VL__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512VL__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512BW__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512BW__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512BITALG__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512BITALG__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512CD__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512CD__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512VPOPCNTDQ__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512VPOPCNTDQ__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512VPOPCNTDQ__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512VNNI__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512VNNI__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512VNNI__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVXVNNI__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVXVNNI__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512DQ__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512DQ__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512BITALG__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512BW__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512CD__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512DQ__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512ER__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512ER__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512IFMA__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512IFMA__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512IFMA__) && defined(__AVX512VL__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVXIFMA__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVXIFMA__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512VBMI__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512VBMI__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VBMI__) && defined(__AVX512VL__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512VBMI2__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512VBMI2__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VBMI2__) && defined(__AVX512VL__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512PF__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512PF__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512FP16__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512FP16__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512FP16__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVX512BF16__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512BF16__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512BF16__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__PKU__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__PKU__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__VPCLMULQDQ__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__VPCLMULQDQ__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__VAES__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__VAES__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__GFNI__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__GFNI__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVXVNNIINT8__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVXVNNIINT8__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVXNECONVERT__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVXNECONVERT__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SHA512__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SHA512__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SM3__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SM3__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SM4__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SM4__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AVXVNNIINT16__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AVXVNNIINT16__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__RDPID__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__RDPID__) + /// Reads the value of the IA32_TSC_AUX MSR (0xc0000103). + /// + /// \headerfile +@@ -304,8 +262,7 @@ _rdpid_u32(void) { + } + #endif // __RDPID__ + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__RDRND__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__RDRND__) + /// Returns a 16-bit hardware-generated random value. + /// + /// \headerfile +@@ -367,8 +324,7 @@ _rdrand64_step(unsigned long long *__p) + } + #endif /* __RDRND__ */ + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__FSGSBASE__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__FSGSBASE__) + #ifdef __x86_64__ + /// Reads the FS base register. + /// +@@ -481,8 +437,7 @@ _writegsbase_u64(unsigned long long __V) + #endif + #endif /* __FSGSBASE__ */ + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__MOVBE__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__MOVBE__) + + /* The structs used below are to force the load/store to be unaligned. This + * is accomplished with the __packed__ attribute. The __may_alias__ prevents +@@ -598,139 +553,118 @@ _storebe_i64(void * __P, long long __D) { + #endif + #endif /* __MOVBE */ + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__RTM__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__RTM__) + #include + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SHA__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SHA__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__FXSR__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__FXSR__) + #include + #endif + + /* No feature check desired due to internal MSC_VER checks */ + #include + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__XSAVEOPT__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__XSAVEOPT__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__XSAVEC__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__XSAVEC__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__XSAVES__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__XSAVES__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SHSTK__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SHSTK__) + #include + #endif + + /* Intrinsics inside adcintrin.h are available at all times. */ + #include + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__ADX__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__ADX__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__RDSEED__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__RDSEED__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__WBNOINVD__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__WBNOINVD__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__CLDEMOTE__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__CLDEMOTE__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__WAITPKG__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__WAITPKG__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__MOVDIRI__) || defined(__MOVDIR64B__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__MOVDIRI__) || \ ++ defined(__MOVDIR64B__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__PCONFIG__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__PCONFIG__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SGX__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SGX__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__PTWRITE__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__PTWRITE__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__INVPCID__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__INVPCID__) + #include + #endif +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AMX_FP16__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AMX_FP16__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__KL__) || defined(__WIDEKL__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__KL__) || \ ++ defined(__WIDEKL__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AMX_TILE__) || defined(__AMX_INT8__) || defined(__AMX_BF16__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AMX_TILE__) || \ ++ defined(__AMX_INT8__) || defined(__AMX_BF16__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__AMX_COMPLEX__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__AMX_COMPLEX__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + defined(__AVX512VP2INTERSECT__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ ++#if !defined(__SCE__) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512VP2INTERSECT__)) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__ENQCMD__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__ENQCMD__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SERIALIZE__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SERIALIZE__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__TSXLDTRK__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__TSXLDTRK__) + #include + #endif + +diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h +index a6395143db54c2..fd27955fbe002d 100644 +--- a/clang/lib/Headers/intrin.h ++++ b/clang/lib/Headers/intrin.h +@@ -15,6 +15,8 @@ + #ifndef __INTRIN_H + #define __INTRIN_H + ++#include ++ + /* First include the standard intrinsics. */ + #if defined(__i386__) || defined(__x86_64__) + #include +@@ -131,8 +133,6 @@ void __writefsqword(unsigned long, unsigned __int64); + void __writefsword(unsigned long, unsigned short); + void __writemsr(unsigned long, unsigned __int64); + void *_AddressOfReturnAddress(void); +-unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask); +-unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask); + unsigned char _bittest(long const *, long); + unsigned char _bittestandcomplement(long *, long); + unsigned char _bittestandreset(long *, long); +@@ -151,7 +151,6 @@ long _InterlockedExchangeAdd_HLERelease(long volatile *, long); + __int64 _InterlockedExchangeAdd64_HLEAcquire(__int64 volatile *, __int64); + __int64 _InterlockedExchangeAdd64_HLERelease(__int64 volatile *, __int64); + void _ReadBarrier(void); +-void _ReadWriteBarrier(void); + unsigned int _rorx_u32(unsigned int, const unsigned int); + int _sarx_i32(int, unsigned int); + #if __STDC_HOSTED__ +@@ -182,12 +181,6 @@ unsigned char __readgsbyte(unsigned long); + unsigned long __readgsdword(unsigned long); + unsigned __int64 __readgsqword(unsigned long); + unsigned short __readgsword(unsigned long); +-unsigned __int64 __shiftleft128(unsigned __int64 _LowPart, +- unsigned __int64 _HighPart, +- unsigned char _Shift); +-unsigned __int64 __shiftright128(unsigned __int64 _LowPart, +- unsigned __int64 _HighPart, +- unsigned char _Shift); + void __stosq(unsigned __int64 *, unsigned __int64, size_t); + unsigned char __vmx_on(unsigned __int64 *); + unsigned char __vmx_vmclear(unsigned __int64 *); +@@ -236,212 +229,10 @@ unsigned __int64 _shlx_u64(unsigned __int64, unsigned int); + unsigned __int64 _shrx_u64(unsigned __int64, unsigned int); + __int64 __mulh(__int64, __int64); + unsigned __int64 __umulh(unsigned __int64, unsigned __int64); +-__int64 _mul128(__int64, __int64, __int64*); +-unsigned __int64 _umul128(unsigned __int64, +- unsigned __int64, +- unsigned __int64*); ++__int64 _mul128(__int64, __int64, __int64 *); + + #endif /* __x86_64__ */ + +-#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) +- +-unsigned char _BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask); +-unsigned char _BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask); +- +-#endif +- +-#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) +-__int64 _InterlockedDecrement64(__int64 volatile *_Addend); +-__int64 _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value); +-__int64 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value); +-__int64 _InterlockedExchangeSub64(__int64 volatile *_Subend, __int64 _Value); +-__int64 _InterlockedIncrement64(__int64 volatile *_Addend); +-__int64 _InterlockedOr64(__int64 volatile *_Value, __int64 _Mask); +-__int64 _InterlockedXor64(__int64 volatile *_Value, __int64 _Mask); +-__int64 _InterlockedAnd64(__int64 volatile *_Value, __int64 _Mask); +- +-#endif +- +-/*----------------------------------------------------------------------------*\ +-|* Interlocked Exchange Add +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-char _InterlockedExchangeAdd8_acq(char volatile *_Addend, char _Value); +-char _InterlockedExchangeAdd8_nf(char volatile *_Addend, char _Value); +-char _InterlockedExchangeAdd8_rel(char volatile *_Addend, char _Value); +-short _InterlockedExchangeAdd16_acq(short volatile *_Addend, short _Value); +-short _InterlockedExchangeAdd16_nf(short volatile *_Addend, short _Value); +-short _InterlockedExchangeAdd16_rel(short volatile *_Addend, short _Value); +-long _InterlockedExchangeAdd_acq(long volatile *_Addend, long _Value); +-long _InterlockedExchangeAdd_nf(long volatile *_Addend, long _Value); +-long _InterlockedExchangeAdd_rel(long volatile *_Addend, long _Value); +-__int64 _InterlockedExchangeAdd64_acq(__int64 volatile *_Addend, __int64 _Value); +-__int64 _InterlockedExchangeAdd64_nf(__int64 volatile *_Addend, __int64 _Value); +-__int64 _InterlockedExchangeAdd64_rel(__int64 volatile *_Addend, __int64 _Value); +-#endif +-/*----------------------------------------------------------------------------*\ +-|* Interlocked Increment +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-short _InterlockedIncrement16_acq(short volatile *_Value); +-short _InterlockedIncrement16_nf(short volatile *_Value); +-short _InterlockedIncrement16_rel(short volatile *_Value); +-long _InterlockedIncrement_acq(long volatile *_Value); +-long _InterlockedIncrement_nf(long volatile *_Value); +-long _InterlockedIncrement_rel(long volatile *_Value); +-__int64 _InterlockedIncrement64_acq(__int64 volatile *_Value); +-__int64 _InterlockedIncrement64_nf(__int64 volatile *_Value); +-__int64 _InterlockedIncrement64_rel(__int64 volatile *_Value); +-#endif +-/*----------------------------------------------------------------------------*\ +-|* Interlocked Decrement +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-short _InterlockedDecrement16_acq(short volatile *_Value); +-short _InterlockedDecrement16_nf(short volatile *_Value); +-short _InterlockedDecrement16_rel(short volatile *_Value); +-long _InterlockedDecrement_acq(long volatile *_Value); +-long _InterlockedDecrement_nf(long volatile *_Value); +-long _InterlockedDecrement_rel(long volatile *_Value); +-__int64 _InterlockedDecrement64_acq(__int64 volatile *_Value); +-__int64 _InterlockedDecrement64_nf(__int64 volatile *_Value); +-__int64 _InterlockedDecrement64_rel(__int64 volatile *_Value); +-#endif +-/*----------------------------------------------------------------------------*\ +-|* Interlocked And +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-char _InterlockedAnd8_acq(char volatile *_Value, char _Mask); +-char _InterlockedAnd8_nf(char volatile *_Value, char _Mask); +-char _InterlockedAnd8_rel(char volatile *_Value, char _Mask); +-short _InterlockedAnd16_acq(short volatile *_Value, short _Mask); +-short _InterlockedAnd16_nf(short volatile *_Value, short _Mask); +-short _InterlockedAnd16_rel(short volatile *_Value, short _Mask); +-long _InterlockedAnd_acq(long volatile *_Value, long _Mask); +-long _InterlockedAnd_nf(long volatile *_Value, long _Mask); +-long _InterlockedAnd_rel(long volatile *_Value, long _Mask); +-__int64 _InterlockedAnd64_acq(__int64 volatile *_Value, __int64 _Mask); +-__int64 _InterlockedAnd64_nf(__int64 volatile *_Value, __int64 _Mask); +-__int64 _InterlockedAnd64_rel(__int64 volatile *_Value, __int64 _Mask); +-#endif +-/*----------------------------------------------------------------------------*\ +-|* Bit Counting and Testing +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-unsigned char _interlockedbittestandset_acq(long volatile *_BitBase, +- long _BitPos); +-unsigned char _interlockedbittestandset_nf(long volatile *_BitBase, +- long _BitPos); +-unsigned char _interlockedbittestandset_rel(long volatile *_BitBase, +- long _BitPos); +-unsigned char _interlockedbittestandreset_acq(long volatile *_BitBase, +- long _BitPos); +-unsigned char _interlockedbittestandreset_nf(long volatile *_BitBase, +- long _BitPos); +-unsigned char _interlockedbittestandreset_rel(long volatile *_BitBase, +- long _BitPos); +-#endif +-/*----------------------------------------------------------------------------*\ +-|* Interlocked Or +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-char _InterlockedOr8_acq(char volatile *_Value, char _Mask); +-char _InterlockedOr8_nf(char volatile *_Value, char _Mask); +-char _InterlockedOr8_rel(char volatile *_Value, char _Mask); +-short _InterlockedOr16_acq(short volatile *_Value, short _Mask); +-short _InterlockedOr16_nf(short volatile *_Value, short _Mask); +-short _InterlockedOr16_rel(short volatile *_Value, short _Mask); +-long _InterlockedOr_acq(long volatile *_Value, long _Mask); +-long _InterlockedOr_nf(long volatile *_Value, long _Mask); +-long _InterlockedOr_rel(long volatile *_Value, long _Mask); +-__int64 _InterlockedOr64_acq(__int64 volatile *_Value, __int64 _Mask); +-__int64 _InterlockedOr64_nf(__int64 volatile *_Value, __int64 _Mask); +-__int64 _InterlockedOr64_rel(__int64 volatile *_Value, __int64 _Mask); +-#endif +-/*----------------------------------------------------------------------------*\ +-|* Interlocked Xor +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-char _InterlockedXor8_acq(char volatile *_Value, char _Mask); +-char _InterlockedXor8_nf(char volatile *_Value, char _Mask); +-char _InterlockedXor8_rel(char volatile *_Value, char _Mask); +-short _InterlockedXor16_acq(short volatile *_Value, short _Mask); +-short _InterlockedXor16_nf(short volatile *_Value, short _Mask); +-short _InterlockedXor16_rel(short volatile *_Value, short _Mask); +-long _InterlockedXor_acq(long volatile *_Value, long _Mask); +-long _InterlockedXor_nf(long volatile *_Value, long _Mask); +-long _InterlockedXor_rel(long volatile *_Value, long _Mask); +-__int64 _InterlockedXor64_acq(__int64 volatile *_Value, __int64 _Mask); +-__int64 _InterlockedXor64_nf(__int64 volatile *_Value, __int64 _Mask); +-__int64 _InterlockedXor64_rel(__int64 volatile *_Value, __int64 _Mask); +-#endif +-/*----------------------------------------------------------------------------*\ +-|* Interlocked Exchange +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-char _InterlockedExchange8_acq(char volatile *_Target, char _Value); +-char _InterlockedExchange8_nf(char volatile *_Target, char _Value); +-char _InterlockedExchange8_rel(char volatile *_Target, char _Value); +-short _InterlockedExchange16_acq(short volatile *_Target, short _Value); +-short _InterlockedExchange16_nf(short volatile *_Target, short _Value); +-short _InterlockedExchange16_rel(short volatile *_Target, short _Value); +-long _InterlockedExchange_acq(long volatile *_Target, long _Value); +-long _InterlockedExchange_nf(long volatile *_Target, long _Value); +-long _InterlockedExchange_rel(long volatile *_Target, long _Value); +-__int64 _InterlockedExchange64_acq(__int64 volatile *_Target, __int64 _Value); +-__int64 _InterlockedExchange64_nf(__int64 volatile *_Target, __int64 _Value); +-__int64 _InterlockedExchange64_rel(__int64 volatile *_Target, __int64 _Value); +-#endif +-/*----------------------------------------------------------------------------*\ +-|* Interlocked Compare Exchange +-\*----------------------------------------------------------------------------*/ +-#if defined(__arm__) || defined(__aarch64__) +-char _InterlockedCompareExchange8_acq(char volatile *_Destination, +- char _Exchange, char _Comparand); +-char _InterlockedCompareExchange8_nf(char volatile *_Destination, +- char _Exchange, char _Comparand); +-char _InterlockedCompareExchange8_rel(char volatile *_Destination, +- char _Exchange, char _Comparand); +-short _InterlockedCompareExchange16_acq(short volatile *_Destination, +- short _Exchange, short _Comparand); +-short _InterlockedCompareExchange16_nf(short volatile *_Destination, +- short _Exchange, short _Comparand); +-short _InterlockedCompareExchange16_rel(short volatile *_Destination, +- short _Exchange, short _Comparand); +-long _InterlockedCompareExchange_acq(long volatile *_Destination, +- long _Exchange, long _Comparand); +-long _InterlockedCompareExchange_nf(long volatile *_Destination, +- long _Exchange, long _Comparand); +-long _InterlockedCompareExchange_rel(long volatile *_Destination, +- long _Exchange, long _Comparand); +-__int64 _InterlockedCompareExchange64_acq(__int64 volatile *_Destination, +- __int64 _Exchange, __int64 _Comparand); +-__int64 _InterlockedCompareExchange64_nf(__int64 volatile *_Destination, +- __int64 _Exchange, __int64 _Comparand); +-__int64 _InterlockedCompareExchange64_rel(__int64 volatile *_Destination, +- __int64 _Exchange, __int64 _Comparand); +-#endif +-#if defined(__x86_64__) || defined(__aarch64__) +-unsigned char _InterlockedCompareExchange128(__int64 volatile *_Destination, +- __int64 _ExchangeHigh, +- __int64 _ExchangeLow, +- __int64 *_ComparandResult); +-#endif +-#if defined(__aarch64__) +-unsigned char _InterlockedCompareExchange128_acq(__int64 volatile *_Destination, +- __int64 _ExchangeHigh, +- __int64 _ExchangeLow, +- __int64 *_ComparandResult); +-unsigned char _InterlockedCompareExchange128_nf(__int64 volatile *_Destination, +- __int64 _ExchangeHigh, +- __int64 _ExchangeLow, +- __int64 *_ComparandResult); +-unsigned char _InterlockedCompareExchange128_rel(__int64 volatile *_Destination, +- __int64 _ExchangeHigh, +- __int64 _ExchangeLow, +- __int64 *_ComparandResult); +-#endif +- + /*----------------------------------------------------------------------------*\ + |* movs, stos + \*----------------------------------------------------------------------------*/ +@@ -583,8 +374,6 @@ unsigned int _CountLeadingOnes(unsigned long); + unsigned int _CountLeadingOnes64(unsigned __int64); + unsigned int _CountLeadingSigns(long); + unsigned int _CountLeadingSigns64(__int64); +-unsigned int _CountLeadingZeros(unsigned long); +-unsigned int _CountLeadingZeros64(unsigned _int64); + unsigned int _CountOneBits(unsigned long); + unsigned int _CountOneBits64(unsigned __int64); + +diff --git a/clang/lib/Headers/intrin0.h b/clang/lib/Headers/intrin0.h +new file mode 100644 +index 00000000000000..31f362ec84d5c5 +--- /dev/null ++++ b/clang/lib/Headers/intrin0.h +@@ -0,0 +1,247 @@ ++/* ===-------- intrin.h ---------------------------------------------------=== ++ * ++ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++ * See https://llvm.org/LICENSE.txt for license information. ++ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++ * ++ *===-----------------------------------------------------------------------=== ++ */ ++ ++/* Only include this if we're compiling for the windows platform. */ ++#ifndef _MSC_VER ++#include_next ++#else ++ ++#ifndef __INTRIN0_H ++#define __INTRIN0_H ++ ++#ifdef __x86_64__ ++#include ++#endif ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask); ++unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask); ++void _ReadWriteBarrier(void); ++ ++#if defined(__aarch64__) ++unsigned int _CountLeadingZeros(unsigned long); ++unsigned int _CountLeadingZeros64(unsigned _int64); ++unsigned char _InterlockedCompareExchange128_acq(__int64 volatile *_Destination, ++ __int64 _ExchangeHigh, ++ __int64 _ExchangeLow, ++ __int64 *_ComparandResult); ++unsigned char _InterlockedCompareExchange128_nf(__int64 volatile *_Destination, ++ __int64 _ExchangeHigh, ++ __int64 _ExchangeLow, ++ __int64 *_ComparandResult); ++unsigned char _InterlockedCompareExchange128_rel(__int64 volatile *_Destination, ++ __int64 _ExchangeHigh, ++ __int64 _ExchangeLow, ++ __int64 *_ComparandResult); ++#endif ++ ++#ifdef __x86_64__ ++unsigned __int64 _umul128(unsigned __int64, unsigned __int64, ++ unsigned __int64 *); ++unsigned __int64 __shiftleft128(unsigned __int64 _LowPart, ++ unsigned __int64 _HighPart, ++ unsigned char _Shift); ++unsigned __int64 __shiftright128(unsigned __int64 _LowPart, ++ unsigned __int64 _HighPart, ++ unsigned char _Shift); ++#endif ++ ++#if defined(__x86_64__) || defined(__i386__) ++void _mm_pause(void); ++#endif ++ ++#if defined(__x86_64__) || defined(__aarch64__) ++unsigned char _InterlockedCompareExchange128(__int64 volatile *_Destination, ++ __int64 _ExchangeHigh, ++ __int64 _ExchangeLow, ++ __int64 *_ComparandResult); ++#endif ++ ++#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) ++unsigned char _BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask); ++unsigned char _BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask); ++#endif ++ ++#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \ ++ defined(__aarch64__) ++__int64 _InterlockedDecrement64(__int64 volatile *_Addend); ++__int64 _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value); ++__int64 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value); ++__int64 _InterlockedExchangeSub64(__int64 volatile *_Subend, __int64 _Value); ++__int64 _InterlockedIncrement64(__int64 volatile *_Addend); ++__int64 _InterlockedOr64(__int64 volatile *_Value, __int64 _Mask); ++__int64 _InterlockedXor64(__int64 volatile *_Value, __int64 _Mask); ++__int64 _InterlockedAnd64(__int64 volatile *_Value, __int64 _Mask); ++#endif ++ ++#if defined(__arm__) || defined(__aarch64__) ++/*----------------------------------------------------------------------------*\ ++|* Interlocked Exchange Add ++\*----------------------------------------------------------------------------*/ ++char _InterlockedExchangeAdd8_acq(char volatile *_Addend, char _Value); ++char _InterlockedExchangeAdd8_nf(char volatile *_Addend, char _Value); ++char _InterlockedExchangeAdd8_rel(char volatile *_Addend, char _Value); ++short _InterlockedExchangeAdd16_acq(short volatile *_Addend, short _Value); ++short _InterlockedExchangeAdd16_nf(short volatile *_Addend, short _Value); ++short _InterlockedExchangeAdd16_rel(short volatile *_Addend, short _Value); ++long _InterlockedExchangeAdd_acq(long volatile *_Addend, long _Value); ++long _InterlockedExchangeAdd_nf(long volatile *_Addend, long _Value); ++long _InterlockedExchangeAdd_rel(long volatile *_Addend, long _Value); ++__int64 _InterlockedExchangeAdd64_acq(__int64 volatile *_Addend, ++ __int64 _Value); ++__int64 _InterlockedExchangeAdd64_nf(__int64 volatile *_Addend, __int64 _Value); ++__int64 _InterlockedExchangeAdd64_rel(__int64 volatile *_Addend, ++ __int64 _Value); ++ ++/*----------------------------------------------------------------------------*\ ++|* Interlocked Increment ++\*----------------------------------------------------------------------------*/ ++short _InterlockedIncrement16_acq(short volatile *_Value); ++short _InterlockedIncrement16_nf(short volatile *_Value); ++short _InterlockedIncrement16_rel(short volatile *_Value); ++long _InterlockedIncrement_acq(long volatile *_Value); ++long _InterlockedIncrement_nf(long volatile *_Value); ++long _InterlockedIncrement_rel(long volatile *_Value); ++__int64 _InterlockedIncrement64_acq(__int64 volatile *_Value); ++__int64 _InterlockedIncrement64_nf(__int64 volatile *_Value); ++__int64 _InterlockedIncrement64_rel(__int64 volatile *_Value); ++ ++/*----------------------------------------------------------------------------*\ ++|* Interlocked Decrement ++\*----------------------------------------------------------------------------*/ ++short _InterlockedDecrement16_acq(short volatile *_Value); ++short _InterlockedDecrement16_nf(short volatile *_Value); ++short _InterlockedDecrement16_rel(short volatile *_Value); ++long _InterlockedDecrement_acq(long volatile *_Value); ++long _InterlockedDecrement_nf(long volatile *_Value); ++long _InterlockedDecrement_rel(long volatile *_Value); ++__int64 _InterlockedDecrement64_acq(__int64 volatile *_Value); ++__int64 _InterlockedDecrement64_nf(__int64 volatile *_Value); ++__int64 _InterlockedDecrement64_rel(__int64 volatile *_Value); ++ ++/*----------------------------------------------------------------------------*\ ++|* Interlocked And ++\*----------------------------------------------------------------------------*/ ++char _InterlockedAnd8_acq(char volatile *_Value, char _Mask); ++char _InterlockedAnd8_nf(char volatile *_Value, char _Mask); ++char _InterlockedAnd8_rel(char volatile *_Value, char _Mask); ++short _InterlockedAnd16_acq(short volatile *_Value, short _Mask); ++short _InterlockedAnd16_nf(short volatile *_Value, short _Mask); ++short _InterlockedAnd16_rel(short volatile *_Value, short _Mask); ++long _InterlockedAnd_acq(long volatile *_Value, long _Mask); ++long _InterlockedAnd_nf(long volatile *_Value, long _Mask); ++long _InterlockedAnd_rel(long volatile *_Value, long _Mask); ++__int64 _InterlockedAnd64_acq(__int64 volatile *_Value, __int64 _Mask); ++__int64 _InterlockedAnd64_nf(__int64 volatile *_Value, __int64 _Mask); ++__int64 _InterlockedAnd64_rel(__int64 volatile *_Value, __int64 _Mask); ++ ++/*----------------------------------------------------------------------------*\ ++|* Bit Counting and Testing ++\*----------------------------------------------------------------------------*/ ++unsigned char _interlockedbittestandset_acq(long volatile *_BitBase, ++ long _BitPos); ++unsigned char _interlockedbittestandset_nf(long volatile *_BitBase, ++ long _BitPos); ++unsigned char _interlockedbittestandset_rel(long volatile *_BitBase, ++ long _BitPos); ++unsigned char _interlockedbittestandreset_acq(long volatile *_BitBase, ++ long _BitPos); ++unsigned char _interlockedbittestandreset_nf(long volatile *_BitBase, ++ long _BitPos); ++unsigned char _interlockedbittestandreset_rel(long volatile *_BitBase, ++ long _BitPos); ++ ++/*----------------------------------------------------------------------------*\ ++|* Interlocked Or ++\*----------------------------------------------------------------------------*/ ++char _InterlockedOr8_acq(char volatile *_Value, char _Mask); ++char _InterlockedOr8_nf(char volatile *_Value, char _Mask); ++char _InterlockedOr8_rel(char volatile *_Value, char _Mask); ++short _InterlockedOr16_acq(short volatile *_Value, short _Mask); ++short _InterlockedOr16_nf(short volatile *_Value, short _Mask); ++short _InterlockedOr16_rel(short volatile *_Value, short _Mask); ++long _InterlockedOr_acq(long volatile *_Value, long _Mask); ++long _InterlockedOr_nf(long volatile *_Value, long _Mask); ++long _InterlockedOr_rel(long volatile *_Value, long _Mask); ++__int64 _InterlockedOr64_acq(__int64 volatile *_Value, __int64 _Mask); ++__int64 _InterlockedOr64_nf(__int64 volatile *_Value, __int64 _Mask); ++__int64 _InterlockedOr64_rel(__int64 volatile *_Value, __int64 _Mask); ++ ++/*----------------------------------------------------------------------------*\ ++|* Interlocked Xor ++\*----------------------------------------------------------------------------*/ ++char _InterlockedXor8_acq(char volatile *_Value, char _Mask); ++char _InterlockedXor8_nf(char volatile *_Value, char _Mask); ++char _InterlockedXor8_rel(char volatile *_Value, char _Mask); ++short _InterlockedXor16_acq(short volatile *_Value, short _Mask); ++short _InterlockedXor16_nf(short volatile *_Value, short _Mask); ++short _InterlockedXor16_rel(short volatile *_Value, short _Mask); ++long _InterlockedXor_acq(long volatile *_Value, long _Mask); ++long _InterlockedXor_nf(long volatile *_Value, long _Mask); ++long _InterlockedXor_rel(long volatile *_Value, long _Mask); ++__int64 _InterlockedXor64_acq(__int64 volatile *_Value, __int64 _Mask); ++__int64 _InterlockedXor64_nf(__int64 volatile *_Value, __int64 _Mask); ++__int64 _InterlockedXor64_rel(__int64 volatile *_Value, __int64 _Mask); ++ ++/*----------------------------------------------------------------------------*\ ++|* Interlocked Exchange ++\*----------------------------------------------------------------------------*/ ++char _InterlockedExchange8_acq(char volatile *_Target, char _Value); ++char _InterlockedExchange8_nf(char volatile *_Target, char _Value); ++char _InterlockedExchange8_rel(char volatile *_Target, char _Value); ++short _InterlockedExchange16_acq(short volatile *_Target, short _Value); ++short _InterlockedExchange16_nf(short volatile *_Target, short _Value); ++short _InterlockedExchange16_rel(short volatile *_Target, short _Value); ++long _InterlockedExchange_acq(long volatile *_Target, long _Value); ++long _InterlockedExchange_nf(long volatile *_Target, long _Value); ++long _InterlockedExchange_rel(long volatile *_Target, long _Value); ++__int64 _InterlockedExchange64_acq(__int64 volatile *_Target, __int64 _Value); ++__int64 _InterlockedExchange64_nf(__int64 volatile *_Target, __int64 _Value); ++__int64 _InterlockedExchange64_rel(__int64 volatile *_Target, __int64 _Value); ++ ++/*----------------------------------------------------------------------------*\ ++|* Interlocked Compare Exchange ++\*----------------------------------------------------------------------------*/ ++char _InterlockedCompareExchange8_acq(char volatile *_Destination, ++ char _Exchange, char _Comparand); ++char _InterlockedCompareExchange8_nf(char volatile *_Destination, ++ char _Exchange, char _Comparand); ++char _InterlockedCompareExchange8_rel(char volatile *_Destination, ++ char _Exchange, char _Comparand); ++short _InterlockedCompareExchange16_acq(short volatile *_Destination, ++ short _Exchange, short _Comparand); ++short _InterlockedCompareExchange16_nf(short volatile *_Destination, ++ short _Exchange, short _Comparand); ++short _InterlockedCompareExchange16_rel(short volatile *_Destination, ++ short _Exchange, short _Comparand); ++long _InterlockedCompareExchange_acq(long volatile *_Destination, ++ long _Exchange, long _Comparand); ++long _InterlockedCompareExchange_nf(long volatile *_Destination, long _Exchange, ++ long _Comparand); ++long _InterlockedCompareExchange_rel(long volatile *_Destination, ++ long _Exchange, long _Comparand); ++__int64 _InterlockedCompareExchange64_acq(__int64 volatile *_Destination, ++ __int64 _Exchange, ++ __int64 _Comparand); ++__int64 _InterlockedCompareExchange64_nf(__int64 volatile *_Destination, ++ __int64 _Exchange, __int64 _Comparand); ++__int64 _InterlockedCompareExchange64_rel(__int64 volatile *_Destination, ++ __int64 _Exchange, ++ __int64 _Comparand); ++#endif ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* __INTRIN0_H */ ++#endif /* _MSC_VER */ +diff --git a/clang/lib/Headers/keylockerintrin.h b/clang/lib/Headers/keylockerintrin.h +index 1994ac42070ad3..f76e91b4d4b306 100644 +--- a/clang/lib/Headers/keylockerintrin.h ++++ b/clang/lib/Headers/keylockerintrin.h +@@ -28,8 +28,7 @@ + #ifndef _KEYLOCKERINTRIN_H + #define _KEYLOCKERINTRIN_H + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__KL__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__KL__) + + /* Define the default attributes for the functions in this file. */ + #define __DEFAULT_FN_ATTRS \ +@@ -327,11 +326,9 @@ _mm_aesdec256kl_u8(__m128i* __odata, __m128i __idata, const void *__h) { + + #undef __DEFAULT_FN_ATTRS + +-#endif /* !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) \ +- || defined(__KL__) */ ++#endif /* !defined(__SCE__ || __has_feature(modules) || defined(__KL__) */ + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__WIDEKL__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__WIDEKL__) + + /* Define the default attributes for the functions in this file. */ + #define __DEFAULT_FN_ATTRS \ +@@ -524,7 +521,7 @@ _mm_aesdecwide256kl_u8(__m128i __odata[8], const __m128i __idata[8], const void* + + #undef __DEFAULT_FN_ATTRS + +-#endif /* !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) \ +- || defined(__WIDEKL__) */ ++#endif /* !defined(__SCE__) || __has_feature(modules) || defined(__WIDEKL__) \ ++ */ + + #endif /* _KEYLOCKERINTRIN_H */ +diff --git a/clang/lib/Headers/x86gprintrin.h b/clang/lib/Headers/x86gprintrin.h +index ed141879fbc744..3d5cc606d7e63d 100644 +--- a/clang/lib/Headers/x86gprintrin.h ++++ b/clang/lib/Headers/x86gprintrin.h +@@ -10,38 +10,31 @@ + #ifndef __X86GPRINTRIN_H + #define __X86GPRINTRIN_H + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__HRESET__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__HRESET__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__UINTR__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__UINTR__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__USERMSR__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__USERMSR__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__CRC32__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__CRC32__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__PRFCHI__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__PRFCHI__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__RAOINT__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__RAOINT__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__CMPCCXADD__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__CMPCCXADD__) + #include + #endif + +diff --git a/clang/lib/Headers/x86intrin.h b/clang/lib/Headers/x86intrin.h +index 450fd008dab95b..c20bfbb8fe46e2 100644 +--- a/clang/lib/Headers/x86intrin.h ++++ b/clang/lib/Headers/x86intrin.h +@@ -14,53 +14,43 @@ + + #include + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__3dNOW__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__3dNOW__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__PRFCHW__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__PRFCHW__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__SSE4A__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__SSE4A__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__FMA4__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__FMA4__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__XOP__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__XOP__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__TBM__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__TBM__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__LWP__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__LWP__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__MWAITX__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__MWAITX__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__CLZERO__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__CLZERO__) + #include + #endif + +-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ +- defined(__RDPRU__) ++#if !defined(__SCE__) || __has_feature(modules) || defined(__RDPRU__) + #include + #endif + +diff --git a/clang/lib/Headers/yvals_core.h b/clang/lib/Headers/yvals_core.h +new file mode 100644 +index 00000000000000..5ee194a3e5f5f6 +--- /dev/null ++++ b/clang/lib/Headers/yvals_core.h +@@ -0,0 +1,25 @@ ++//===----- yvals_core.h - Internal MSVC STL core header -------------------===// ++// ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++// See https://llvm.org/LICENSE.txt for license information. ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++// ++//===----------------------------------------------------------------------===// ++ ++// Only include this if we are aiming for MSVC compatibility. ++#ifndef _MSC_VER ++#include_next ++#else ++ ++#ifndef __clang_yvals_core_h ++#define __clang_yvals_core_h ++ ++#include_next ++ ++#ifdef _STL_INTRIN_HEADER ++#undef _STL_INTRIN_HEADER ++#define _STL_INTRIN_HEADER ++#endif ++ ++#endif ++#endif diff --git a/ports/llvm/79694.patch b/ports/llvm/79694.patch new file mode 100644 index 0000000000..702b89a450 --- /dev/null +++ b/ports/llvm/79694.patch @@ -0,0 +1,217 @@ +From 48908fb6d5387082018fb1d8b2f0ddb65e2e2baa Mon Sep 17 00:00:00 2001 +From: Phoebe Wang +Date: Sat, 27 Jan 2024 22:03:06 +0800 +Subject: [PATCH 1/2] [SEH] Ignore EH pad check for internal intrinsics + +Intrinsics like @llvm.seh.scope.begin and @llvm.seh.scope.end which do not throw do not need funclets in catchpads or cleanuppads. + +Fixes #69428 + +Co-authored-by: Robert Cox +--- + llvm/lib/IR/Verifier.cpp | 5 +++ + llvm/test/Verifier/pr69428.ll | 80 +++++++++++++++++++++++++++++++++++ + 2 files changed, 85 insertions(+) + create mode 100644 llvm/test/Verifier/pr69428.ll + +diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp +index 91cf91fbc788bd..0f1e9fa40c9b03 100644 +--- a/llvm/lib/IR/Verifier.cpp ++++ b/llvm/lib/IR/Verifier.cpp +@@ -4280,6 +4280,11 @@ void Verifier::visitEHPadPredecessors(Instruction &I) { + if (auto *II = dyn_cast(TI)) { + Check(II->getUnwindDest() == BB && II->getNormalDest() != BB, + "EH pad must be jumped to via an unwind edge", ToPad, II); ++ auto *CalledFn = ++ dyn_cast(II->getCalledOperand()->stripPointerCasts()); ++ if (CalledFn && CalledFn->isIntrinsic() && II->doesNotThrow() && ++ !IntrinsicInst::mayLowerToFunctionCall(CalledFn->getIntrinsicID())) ++ continue; + if (auto Bundle = II->getOperandBundle(LLVMContext::OB_funclet)) + FromPad = Bundle->Inputs[0]; + else +diff --git a/llvm/test/Verifier/pr69428.ll b/llvm/test/Verifier/pr69428.ll +new file mode 100644 +index 00000000000000..22d732076e3af7 +--- /dev/null ++++ b/llvm/test/Verifier/pr69428.ll +@@ -0,0 +1,80 @@ ++; RUN: llvm-as -disable-output %s ++ ++%struct._List_node_emplace_op2 = type { i8 } ++ ++$"??1?$_List_node_emplace_op2@H@@QEAA@XZ" = comdat any ++ ++@"?_List@@3HA" = dso_local local_unnamed_addr global i32 0, align 4 ++ ++; Function Attrs: mustprogress noreturn ++define dso_local void @"?ExecutionEngineaddExecutableDependency@@YAXXZ"() local_unnamed_addr #0 personality ptr @__CxxFrameHandler3 { ++entry: ++ %agg.tmp.ensured.i = alloca %struct._List_node_emplace_op2, align 1 ++ call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %agg.tmp.ensured.i) ++ %0 = load i32, ptr @"?_List@@3HA", align 4 ++ %call.i = call noundef ptr @"??0?$_List_node_emplace_op2@H@@QEAA@H@Z"(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp.ensured.i, i32 noundef %0) ++ invoke void @llvm.seh.scope.begin() ++ to label %invoke.cont.i unwind label %ehcleanup.i ++ ++invoke.cont.i: ; preds = %entry ++ invoke void @llvm.seh.scope.end() ++ to label %invoke.cont2.i unwind label %ehcleanup.i ++ ++invoke.cont2.i: ; preds = %invoke.cont.i ++ call void @"??1?$_List_node_emplace_op2@H@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp.ensured.i) #6 ++ unreachable ++ ++ehcleanup.i: ; preds = %invoke.cont.i, %entry ++ %1 = cleanuppad within none [] ++ invoke void @llvm.seh.scope.begin() ++ to label %invoke.cont.i.i unwind label %ehcleanup.i.i ++ ++invoke.cont.i.i: ; preds = %ehcleanup.i ++ invoke void @llvm.seh.scope.end() ++ to label %"??1?$_List_node_emplace_op2@H@@QEAA@XZ.exit.i" unwind label %ehcleanup.i.i ++ ++ehcleanup.i.i: ; preds = %invoke.cont.i.i, %ehcleanup.i ++ %2 = cleanuppad within %1 [] ++ call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp.ensured.i) #6 [ "funclet"(token %2) ] ++ cleanupret from %2 unwind to caller ++ ++"??1?$_List_node_emplace_op2@H@@QEAA@XZ.exit.i": ; preds = %invoke.cont.i.i ++ call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp.ensured.i) #6 [ "funclet"(token %1) ] ++ cleanupret from %1 unwind to caller ++} ++ ++declare dso_local noundef ptr @"??0?$_List_node_emplace_op2@H@@QEAA@H@Z"(ptr noundef nonnull returned align 1 dereferenceable(1), i32 noundef) unnamed_addr #1 ++ ++declare dso_local i32 @__CxxFrameHandler3(...) ++ ++; Function Attrs: nofree nosync nounwind memory(none) ++declare dso_local void @llvm.seh.scope.begin() #2 ++ ++; Function Attrs: nofree nosync nounwind memory(none) ++declare dso_local void @llvm.seh.scope.end() #2 ++ ++; Function Attrs: mustprogress nounwind ++define linkonce_odr dso_local void @"??1?$_List_node_emplace_op2@H@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #3 comdat align 2 personality ptr @__CxxFrameHandler3 { ++entry: ++ invoke void @llvm.seh.scope.begin() ++ to label %invoke.cont unwind label %ehcleanup ++ ++invoke.cont: ; preds = %entry ++ invoke void @llvm.seh.scope.end() ++ to label %invoke.cont2 unwind label %ehcleanup ++ ++invoke.cont2: ; preds = %invoke.cont ++ tail call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %this) #6 ++ ret void ++ ++ehcleanup: ; preds = %invoke.cont, %entry ++ %0 = cleanuppad within none [] ++ call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %this) #6 [ "funclet"(token %0) ] ++ cleanupret from %0 unwind to caller ++} ++ ++; Function Attrs: nounwind ++declare dso_local void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 ++ ++; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) ++declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5 + +From a9ea5c30d2fe81ed8774812bf13700c6a81e4900 Mon Sep 17 00:00:00 2001 +From: Phoebe Wang +Date: Fri, 2 Feb 2024 20:19:50 +0800 +Subject: [PATCH 2/2] Simplify test case + +--- + llvm/test/Verifier/pr69428.ll | 56 ++++++++--------------------------- + 1 file changed, 12 insertions(+), 44 deletions(-) + +diff --git a/llvm/test/Verifier/pr69428.ll b/llvm/test/Verifier/pr69428.ll +index 22d732076e3af7..be8733bea1ab39 100644 +--- a/llvm/test/Verifier/pr69428.ll ++++ b/llvm/test/Verifier/pr69428.ll +@@ -2,17 +2,13 @@ + + %struct._List_node_emplace_op2 = type { i8 } + +-$"??1?$_List_node_emplace_op2@H@@QEAA@XZ" = comdat any ++@"?_List@@3HA" = global i32 0, align 4 + +-@"?_List@@3HA" = dso_local local_unnamed_addr global i32 0, align 4 +- +-; Function Attrs: mustprogress noreturn +-define dso_local void @"?ExecutionEngineaddExecutableDependency@@YAXXZ"() local_unnamed_addr #0 personality ptr @__CxxFrameHandler3 { ++define void @"?ExecutionEngineaddExecutableDependency@@YAXXZ"() personality ptr @__CxxFrameHandler3 { + entry: + %agg.tmp.ensured.i = alloca %struct._List_node_emplace_op2, align 1 +- call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %agg.tmp.ensured.i) + %0 = load i32, ptr @"?_List@@3HA", align 4 +- %call.i = call noundef ptr @"??0?$_List_node_emplace_op2@H@@QEAA@H@Z"(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp.ensured.i, i32 noundef %0) ++ %call.i = call noundef ptr @"??0?$_List_node_emplace_op2@H@@QEAA@H@Z"(ptr %agg.tmp.ensured.i, i32 %0) + invoke void @llvm.seh.scope.begin() + to label %invoke.cont.i unwind label %ehcleanup.i + +@@ -21,7 +17,7 @@ invoke.cont.i: ; preds = %entry + to label %invoke.cont2.i unwind label %ehcleanup.i + + invoke.cont2.i: ; preds = %invoke.cont.i +- call void @"??1?$_List_node_emplace_op2@H@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp.ensured.i) #6 ++ call void @"??1?$_List_node_emplace_op2@H@@QEAA@XZ"(ptr %agg.tmp.ensured.i) #6 + unreachable + + ehcleanup.i: ; preds = %invoke.cont.i, %entry +@@ -35,46 +31,18 @@ invoke.cont.i.i: ; preds = %ehcleanup.i + + ehcleanup.i.i: ; preds = %invoke.cont.i.i, %ehcleanup.i + %2 = cleanuppad within %1 [] +- call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp.ensured.i) #6 [ "funclet"(token %2) ] ++ call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr %agg.tmp.ensured.i) #6 [ "funclet"(token %2) ] + cleanupret from %2 unwind to caller + + "??1?$_List_node_emplace_op2@H@@QEAA@XZ.exit.i": ; preds = %invoke.cont.i.i +- call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %agg.tmp.ensured.i) #6 [ "funclet"(token %1) ] ++ call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr %agg.tmp.ensured.i) #6 [ "funclet"(token %1) ] + cleanupret from %1 unwind to caller + } + +-declare dso_local noundef ptr @"??0?$_List_node_emplace_op2@H@@QEAA@H@Z"(ptr noundef nonnull returned align 1 dereferenceable(1), i32 noundef) unnamed_addr #1 +- +-declare dso_local i32 @__CxxFrameHandler3(...) +- +-; Function Attrs: nofree nosync nounwind memory(none) +-declare dso_local void @llvm.seh.scope.begin() #2 +- +-; Function Attrs: nofree nosync nounwind memory(none) +-declare dso_local void @llvm.seh.scope.end() #2 +- +-; Function Attrs: mustprogress nounwind +-define linkonce_odr dso_local void @"??1?$_List_node_emplace_op2@H@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %this) unnamed_addr #3 comdat align 2 personality ptr @__CxxFrameHandler3 { +-entry: +- invoke void @llvm.seh.scope.begin() +- to label %invoke.cont unwind label %ehcleanup +- +-invoke.cont: ; preds = %entry +- invoke void @llvm.seh.scope.end() +- to label %invoke.cont2 unwind label %ehcleanup +- +-invoke.cont2: ; preds = %invoke.cont +- tail call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %this) #6 +- ret void +- +-ehcleanup: ; preds = %invoke.cont, %entry +- %0 = cleanuppad within none [] +- call void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1) %this) #6 [ "funclet"(token %0) ] +- cleanupret from %0 unwind to caller +-} +- +-; Function Attrs: nounwind +-declare dso_local void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 ++declare i32 @__CxxFrameHandler3(...) ++declare void @llvm.seh.scope.begin() ++declare void @llvm.seh.scope.end() + +-; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) +-declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #5 ++declare void @"??1?$_List_node_emplace_op2@H@@QEAA@XZ"(ptr) ++declare void @"??1_Alloc_construct_ptr@@QEAA@XZ"(ptr) ++declare ptr @"??0?$_List_node_emplace_op2@H@@QEAA@H@Z"(ptr, i32) diff --git a/ports/llvm/82407.patch b/ports/llvm/82407.patch new file mode 100644 index 0000000000..c51086b9e0 --- /dev/null +++ b/ports/llvm/82407.patch @@ -0,0 +1,112 @@ +From 5fcaeaddccc0f7e370bf7bebce113d8d52e1b1bd Mon Sep 17 00:00:00 2001 +From: Shafik Yaghmour +Date: Tue, 20 Feb 2024 11:22:39 -0800 +Subject: [PATCH] [Clang][Sema] Fix incorrect rejection default construction of + union with nontrivial member + +In 765d8a192180f8f33618087b15c022fe758044af we impelemented a fix for incorrect deletion of +default constructors in unions. This fix missed a case and so this PR will +extend the fix to cover the additional case. + +Fixes: https://github.com/llvm/llvm-project/issues/81774 +--- + clang/lib/Sema/SemaDeclCXX.cpp | 18 +++++++++++++++--- + .../test/CodeGen/union-non-trivial-member.cpp | 17 +++++++++++++++++ + clang/test/SemaCXX/cxx0x-nontrivial-union.cpp | 11 +++++++++++ + 4 files changed, 46 insertions(+), 3 deletions(-) + + Bug Fixes to AST Handling + ^^^^^^^^^^^^^^^^^^^^^^^^^ +diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp +index 79263bc3ff671..25a4b4381ca25 100644 +--- a/clang/lib/Sema/SemaDeclCXX.cpp ++++ b/clang/lib/Sema/SemaDeclCXX.cpp +@@ -9442,9 +9442,21 @@ bool SpecialMemberDeletionInfo::shouldDeleteForSubobjectCall( + + int DiagKind = -1; + +- if (SMOR.getKind() == Sema::SpecialMemberOverloadResult::NoMemberOrDeleted) +- DiagKind = !Decl ? 0 : 1; +- else if (SMOR.getKind() == Sema::SpecialMemberOverloadResult::Ambiguous) ++ if (SMOR.getKind() == Sema::SpecialMemberOverloadResult::NoMemberOrDeleted) { ++ if (CSM == Sema::CXXDefaultConstructor && Field && ++ Field->getParent()->isUnion()) { ++ // [class.default.ctor]p2: ++ // A defaulted default constructor for class X is defined as deleted if ++ // - X is a union that has a variant member with a non-trivial default ++ // constructor and no variant member of X has a default member ++ // initializer ++ const auto *RD = cast(Field->getParent()); ++ if (!RD->hasInClassInitializer()) ++ DiagKind = !Decl ? 0 : 1; ++ } else { ++ DiagKind = !Decl ? 0 : 1; ++ } ++ } else if (SMOR.getKind() == Sema::SpecialMemberOverloadResult::Ambiguous) + DiagKind = 2; + else if (!isAccessible(Subobj, Decl)) + DiagKind = 3; +diff --git a/clang/test/CodeGen/union-non-trivial-member.cpp b/clang/test/CodeGen/union-non-trivial-member.cpp +index fdc9fd16911e1..8b055a9970fc7 100644 +--- a/clang/test/CodeGen/union-non-trivial-member.cpp ++++ b/clang/test/CodeGen/union-non-trivial-member.cpp +@@ -15,14 +15,25 @@ union UnionNonTrivial { + non_trivial_constructor b{}; + }; + ++struct Handle { ++ Handle(int) {} ++}; ++ ++union UnionNonTrivialEqualInit { ++ int NoState = 0; ++ Handle CustomState; ++}; ++ + void f() { + UnionInt u1; + UnionNonTrivial u2; ++ UnionNonTrivialEqualInit u3; + } + + // CHECK: define dso_local void @_Z1fv() + // CHECK: call void @_ZN8UnionIntC1Ev + // CHECK-NEXT: call void @_ZN15UnionNonTrivialC1Ev ++// CHECK-NEXT: call void @_ZN24UnionNonTrivialEqualInitC1Ev + + // CHECK: define {{.*}}void @_ZN8UnionIntC1Ev + // CHECK: call void @_ZN8UnionIntC2Ev +@@ -30,8 +41,14 @@ void f() { + // CHECK: define {{.*}}void @_ZN15UnionNonTrivialC1Ev + // CHECK: call void @_ZN15UnionNonTrivialC2Ev + ++// CHECK: define {{.*}}void @_ZN24UnionNonTrivialEqualInitC1Ev ++// CHECK: call void @_ZN24UnionNonTrivialEqualInitC2Ev ++ + // CHECK: define {{.*}}void @_ZN8UnionIntC2Ev + // CHECK: store i32 1000 + + // CHECK: define {{.*}}void @_ZN15UnionNonTrivialC2Ev + // CHECK: call void @_ZN23non_trivial_constructorC1Ev ++ ++// CHECK: define {{.*}}void @_ZN24UnionNonTrivialEqualInitC2Ev ++// CHECK: store i32 0 +diff --git a/clang/test/SemaCXX/cxx0x-nontrivial-union.cpp b/clang/test/SemaCXX/cxx0x-nontrivial-union.cpp +index c7cdf76d850db..833642b3d739a 100644 +--- a/clang/test/SemaCXX/cxx0x-nontrivial-union.cpp ++++ b/clang/test/SemaCXX/cxx0x-nontrivial-union.cpp +@@ -188,3 +188,14 @@ static_assert(U2().b.x == 100, ""); + static_assert(U3().b.x == 100, ""); + + } // namespace GH48416 ++ ++namespace GH81774 { ++struct Handle { ++ Handle(int) {} ++}; ++// Should be well-formed because NoState has a brace-or-equal-initializer. ++union a { ++ int NoState = 0; ++ Handle CustomState; ++} b; ++} // namespace GH81774 diff --git a/ports/llvm/portfile.cmake b/ports/llvm/portfile.cmake index a79c72a590..d9affde86d 100644 --- a/ports/llvm/portfile.cmake +++ b/ports/llvm/portfile.cmake @@ -4,7 +4,7 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO llvm/llvm-project REF "llvmorg-${VERSION}" - SHA512 362ddb94fdd22d05bd11c950f1711eafbd47424f6da0b1b061da012ef1b39dd8f7efeb91b53c036ea0708aa3845893fe39d1fb529ac3b928df738b88717d1aee + SHA512 9e9ec501336127339347c01ffd47768d501a84ef415c6a72fe56d31e867f982baeb3c4659be8e9b8475848a460357f33a6b2aa0ee9f81150e363963b98387bc0 HEAD_REF main PATCHES 0001-fix-install-package-dir.patch @@ -13,9 +13,9 @@ vcpkg_from_github( 0004-disable-libomp-aliases.patch 0005-remove-numpy.patch 0006-create-destination-mlir-directory.patch - 0007-fix-compiler-rt-warnings.patch # fixed in upstream - 0008-add-missing-case.patch # From upstream https://github.com/llvm/llvm-project/pull/72401 - 0009-add-missing-typename.patch # Fixed in version 18.1.0 and later + 75711.patch # [clang] Add intrin0.h header to mimic intrin0.h used by MSVC STL for clang-cl #75711 + 79694.patch # [SEH] Ignore EH pad check for internal intrinsics #79694 + 82407.patch # [Clang][Sema] Fix incorrect rejection default construction of union with nontrivial member #82407 ) vcpkg_check_features( @@ -326,20 +326,34 @@ llvm_cmake_package_config_fixup("polly" DO_NOT_DELETE_PARENT_CONFIG_PATH) llvm_cmake_package_config_fixup("ParallelSTL" FEATURE_NAME "pstl" DO_NOT_DELETE_PARENT_CONFIG_PATH CONFIG_PATH "lib/cmake/ParallelSTL") llvm_cmake_package_config_fixup("llvm") -set(empty_dirs) +if("mlir" IN_LIST FEATURES) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/mlir/MLIRConfig.cmake" "set(MLIR_MAIN_SRC_DIR \"${SOURCE_PATH}/mlir\")" "") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/mlir/MLIRConfig.cmake" "${CURRENT_BUILDTREES_DIR}" "\${MLIR_INCLUDE_DIRS}") +endif() +vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}") + +# Move Clang's runtime libraries from bin/lib to tools/${PORT}/lib +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/lib") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}") + file(RENAME "${CURRENT_PACKAGES_DIR}/bin/lib" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/lib") +endif() +if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/lib") + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin/lib") +endif() + +# Remove empty directories to avoid vcpkg warning +set(empty_dirs) if("clang-tools-extra" IN_LIST FEATURES) list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/clang-tidy/plugin") list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/clang-tidy/misc/ConfusableTable") endif() - if("pstl" IN_LIST FEATURES) list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/lib/cmake") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/debug/lib/cmake") endif() endif() - if("flang" IN_LIST FEATURES) list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/CMakeFiles") list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Config") @@ -349,7 +363,6 @@ if("flang" IN_LIST FEATURES) list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/HLFIR/CMakeFiles") list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/Transforms/CMakeFiles") endif() - if(empty_dirs) foreach(empty_dir IN LISTS empty_dirs) if(NOT EXISTS "${empty_dir}") @@ -365,12 +378,7 @@ if(empty_dirs) endforeach() endif() -vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/${PORT}") -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/lib") - file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}") - file(RENAME "${CURRENT_PACKAGES_DIR}/bin/lib" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/lib") -endif() - +# Remove debug headers and tools if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" @@ -378,17 +386,9 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") ) endif() -if("mlir" IN_LIST FEATURES) - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/mlir/MLIRConfig.cmake" "set(MLIR_MAIN_SRC_DIR \"${SOURCE_PATH}/mlir\")" "") - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/mlir/MLIRConfig.cmake" "${CURRENT_BUILDTREES_DIR}" "\${MLIR_INCLUDE_DIRS}") -endif() - +# LLVM generates shared libraries in a static build (LLVM-C.dll, libclang.dll, LTO.dll, Remarks.dll, ...) +# for the corresponding export targets (used in LLVMExports-.cmake files on the Windows platform) if(VCPKG_TARGET_IS_WINDOWS) - # LLVM still generates a few DLLs in the static build: - # * LLVM-C.dll - # * libclang.dll - # * LTO.dll - # * Remarks.dll set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) else() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" diff --git a/ports/llvm/vcpkg.json b/ports/llvm/vcpkg.json index 3bfc831eb5..77f42bcfcc 100644 --- a/ports/llvm/vcpkg.json +++ b/ports/llvm/vcpkg.json @@ -1,7 +1,6 @@ { "name": "llvm", - "version": "17.0.2", - "port-version": 5, + "version": "18.1.6", "description": "The LLVM Compiler Infrastructure.", "homepage": "https://llvm.org", "license": "Apache-2.0", diff --git a/ports/mesa/clover-llvm-move-to-modern-pass-manager.patch b/ports/mesa/clover-llvm-move-to-modern-pass-manager.patch deleted file mode 100644 index 902336776c..0000000000 --- a/ports/mesa/clover-llvm-move-to-modern-pass-manager.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 2d4fe5f229791fde52846b3f583c12508b5109d6 Mon Sep 17 00:00:00 2001 -From: Dave Airlie -Date: Fri, 25 Aug 2023 12:43:44 +1000 -Subject: [PATCH] clover/llvm: move to modern pass manager. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This seems like it should work, but I haven't tested it yet. - -Tested-by: Dieter Nützel -Part-of: ---- - .../frontends/clover/llvm/invocation.cpp | 64 +++++++++++++++---- - 1 file changed, 51 insertions(+), 13 deletions(-) - -diff --git a/src/gallium/frontends/clover/llvm/invocation.cpp b/src/gallium/frontends/clover/llvm/invocation.cpp -index 7a50fea332395..43d26fe1abbce 100644 ---- a/src/gallium/frontends/clover/llvm/invocation.cpp -+++ b/src/gallium/frontends/clover/llvm/invocation.cpp -@@ -27,13 +27,17 @@ - #include - #include - #include -+#include - #include --#include -+#include - #include - #ifdef HAVE_CLOVER_SPIRV - #include - #endif - -+#include -+#include -+#include - #include - #include - #include -@@ -439,10 +443,10 @@ clover::llvm::compile_program(const std::string &source, - - namespace { - void -- optimize(Module &mod, unsigned optimization_level, -+ optimize(Module &mod, -+ const std::string& ir_target, -+ unsigned optimization_level, - bool internalize_symbols) { -- ::llvm::legacy::PassManager pm; -- - // By default, the function internalizer pass will look for a function - // called "main" and then mark all other functions as internal. Marking - // functions as internal enables the optimizer to perform optimizations -@@ -458,19 +462,53 @@ namespace { - if (internalize_symbols) { - std::vector names = - map(std::mem_fn(&Function::getName), get_kernels(mod)); -- pm.add(::llvm::createInternalizePass( -+ internalizeModule(mod, - [=](const ::llvm::GlobalValue &gv) { - return std::find(names.begin(), names.end(), - gv.getName()) != names.end(); -- })); -+ }); - } - -- ::llvm::PassManagerBuilder pmb; -- pmb.OptLevel = optimization_level; -- pmb.LibraryInfo = new ::llvm::TargetLibraryInfoImpl( -- ::llvm::Triple(mod.getTargetTriple())); -- pmb.populateModulePassManager(pm); -- pm.run(mod); -+ -+ const char *opt_str = NULL; -+ LLVMCodeGenOptLevel level; -+ switch (optimization_level) { -+ case 0: -+ default: -+ opt_str = "default"; -+ level = LLVMCodeGenLevelNone; -+ break; -+ case 1: -+ opt_str = "default"; -+ level = LLVMCodeGenLevelLess; -+ break; -+ case 2: -+ opt_str = "default"; -+ level = LLVMCodeGenLevelDefault; -+ break; -+ case 3: -+ opt_str = "default"; -+ level = LLVMCodeGenLevelAggressive; -+ break; -+ } -+ -+ const target &target = ir_target; -+ LLVMTargetRef targ; -+ char *err_message; -+ -+ if (LLVMGetTargetFromTriple(target.triple.c_str(), &targ, &err_message)) -+ return; -+ LLVMTargetMachineRef tm = -+ LLVMCreateTargetMachine(targ, target.triple.c_str(), -+ target.cpu.c_str(), "", level, -+ LLVMRelocDefault, LLVMCodeModelDefault); -+ -+ if (!tm) -+ return; -+ LLVMPassBuilderOptionsRef opts = LLVMCreatePassBuilderOptions(); -+ LLVMRunPasses(wrap(&mod), opt_str, tm, opts); -+ -+ LLVMDisposeTargetMachine(tm); - } - - std::unique_ptr -@@ -500,7 +538,7 @@ clover::llvm::link_program(const std::vector &binaries, - auto c = create_compiler_instance(dev, dev.ir_target(), options, r_log); - auto mod = link(*ctx, *c, binaries, r_log); - -- optimize(*mod, c->getCodeGenOpts().OptimizationLevel, !create_library); -+ optimize(*mod, dev.ir_target(), c->getCodeGenOpts().OptimizationLevel, !create_library); - - static std::atomic_uint seq(0); - const std::string id = "." + mod->getModuleIdentifier() + "-" + --- -GitLab - diff --git a/ports/mesa/gallium-fix-build-with-llvm-17.patch b/ports/mesa/gallium-fix-build-with-llvm-17.patch deleted file mode 100644 index cea5a17f30..0000000000 --- a/ports/mesa/gallium-fix-build-with-llvm-17.patch +++ /dev/null @@ -1,42 +0,0 @@ -From cda32e18a08fa2f2289a7409f37f44d5643e6aea Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 23 Jun 2023 01:20:38 -0700 -Subject: [PATCH] gallium: Fix build with llvm 17 - -These headers are not available for C files in llvm 17+ -and they seem to be not needed to compile after all with llvm 17 -so add conditions to exclude them for llvm >= 17 - -Signed-off-by: Khem Raj ---- - src/gallium/auxiliary/gallivm/lp_bld_init.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c -index cd2108f3a088d..b1a4d0388a6a0 100644 ---- a/src/gallium/auxiliary/gallivm/lp_bld_init.c -+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c -@@ -46,15 +46,19 @@ - #if GALLIVM_USE_NEW_PASS == 1 - #include - #elif GALLIVM_HAVE_CORO == 1 -+#if LLVM_VERSION_MAJOR < 17 - #include --#if LLVM_VERSION_MAJOR >= 7 -+#endif -+#if LLVM_VERSION_MAJOR >= 7 && LLVM_VERSION_MAJOR < 17 - #include - #endif - #if LLVM_VERSION_MAJOR <= 8 && (DETECT_ARCH_AARCH64 || DETECT_ARCH_ARM || DETECT_ARCH_S390 || DETECT_ARCH_MIPS64) - #include - #endif -+#if LLVM_VERSION_MAJOR < 17 - #include - #endif -+#endif - - unsigned gallivm_perf = 0; - --- -GitLab - diff --git a/ports/mesa/portfile.cmake b/ports/mesa/portfile.cmake index 4be8e5936b..0d7e7cadf3 100644 --- a/ports/mesa/portfile.cmake +++ b/ports/mesa/portfile.cmake @@ -8,12 +8,9 @@ vcpkg_from_gitlab( OUT_SOURCE_PATH SOURCE_PATH REPO mesa/mesa REF mesa-${VERSION} - SHA512 96f7602c98d532a269116bd5d3f9cbe87ca4425b309467cc19f83277a0faaa9804edea72dcaeb6f7774cac17790d5d76b58c357ef639cb6064e7480d93b861bf + SHA512 202b2b20ffe7d357570a0d0bf0b53dc246b3e903738e8c8a000c5f61109ab5233d62de217444f49fd62927f8c418d929e5a2a5a800d1e39e334d50eb090e850c FILE_DISAMBIGUATOR 1 HEAD_REF master - PATCHES - gallium-fix-build-with-llvm-17.patch - clover-llvm-move-to-modern-pass-manager.patch ) x_vcpkg_get_python_packages(PYTHON_VERSION "3" OUT_PYTHON_VAR "PYTHON3" PACKAGES setuptools mako) @@ -46,13 +43,9 @@ endif() # For features https://github.com/pal1000/mesa-dist-win should be probably studied a bit more. list(APPEND MESA_OPTIONS -Dzstd=enabled) -list(APPEND MESA_OPTIONS -Dshared-llvm=auto) -list(APPEND MESA_OPTIONS -Dlibunwind=disabled) -list(APPEND MESA_OPTIONS -Dlmsensors=disabled) list(APPEND MESA_OPTIONS -Dvalgrind=disabled) -list(APPEND MESA_OPTIONS -Dglvnd=false) -list(APPEND MESA_OPTIONS -Dglx=disabled) -list(APPEND MESA_OPTIONS -Dgbm=disabled) +list(APPEND MESA_OPTIONS -Dshared-llvm=disabled) +list(APPEND MESA_OPTIONS -Dcpp_rtti=true) if("offscreen" IN_LIST FEATURES) list(APPEND MESA_OPTIONS -Dosmesa=true) @@ -66,29 +59,32 @@ else() list(APPEND MESA_OPTIONS -Dllvm=disabled) endif() +set(use_gles OFF) if("gles1" IN_LIST FEATURES) list(APPEND MESA_OPTIONS -Dgles1=enabled) + set(use_gles ON) else() list(APPEND MESA_OPTIONS -Dgles1=disabled) endif() if("gles2" IN_LIST FEATURES) list(APPEND MESA_OPTIONS -Dgles2=enabled) + set(use_gles ON) else() list(APPEND MESA_OPTIONS -Dgles2=disabled) endif() -if("opengl" IN_LIST FEATURES) - list(APPEND MESA_OPTIONS -Dopengl=true) + +if(use_gles) + list(APPEND MESA_OPTIONS -Dshared-glapi=enabled) # shared GLAPI required when building two or more of the following APIs - gles1 gles2 else() - list(APPEND MESA_OPTIONS -Dopengl=false) + list(APPEND MESA_OPTIONS -Dshared-glapi=auto) endif() -if("egl" IN_LIST FEATURES) # EGL feature only works on Linux + +if("egl" IN_LIST FEATURES) list(APPEND MESA_OPTIONS -Degl=enabled) else() list(APPEND MESA_OPTIONS -Degl=disabled) endif() -list(APPEND MESA_OPTIONS -Dshared-glapi=enabled) #shared GLAPI required when building two or more of the following APIs - opengl, gles1 gles2 - if(VCPKG_TARGET_IS_WINDOWS) list(APPEND MESA_OPTIONS -Dplatforms=['windows']) list(APPEND MESA_OPTIONS -Dmicrosoft-clc=disabled) @@ -102,13 +98,12 @@ vcpkg_configure_meson( SOURCE_PATH "${SOURCE_PATH}" OPTIONS -Dgles-lib-suffix=_mesa - #-D egl-lib-suffix=_mesa -Dbuild-tests=false ${MESA_OPTIONS} ADDITIONAL_BINARIES - python=['${PYTHON3}','-I'] - python3=['${PYTHON3}','-I'] - ) + python=['${PYTHON3}','-I'] + python3=['${PYTHON3}','-I'] +) vcpkg_install_meson() vcpkg_fixup_pkgconfig() diff --git a/ports/mesa/vcpkg.json b/ports/mesa/vcpkg.json index 08ccaecd56..ebcec98362 100644 --- a/ports/mesa/vcpkg.json +++ b/ports/mesa/vcpkg.json @@ -1,7 +1,6 @@ { "name": "mesa", - "version": "23.2.1", - "port-version": 1, + "version": "24.0.7", "description": "Mesa - The 3D Graphics Library", "homepage": "https://www.mesa3d.org/", "license": "MIT AND BSL-1.0 AND SGI-B-2.0", @@ -30,8 +29,7 @@ "default-features": false, "features": [ "gles1", - "gles2", - "opengl" + "gles2" ] }, { @@ -41,6 +39,14 @@ "llvm" ], "platform": "x64" + }, + { + "name": "mesa", + "default-features": false, + "features": [ + "egl" + ], + "platform": "!osx" } ] }, @@ -53,25 +59,13 @@ "gles1": { "description": "Build support for OpenGL ES 1.x", "dependencies": [ - { - "name": "mesa", - "default-features": false, - "features": [ - "opengl" - ] - } + "opengl" ] }, "gles2": { "description": "Build support for OpenGL ES 2.x and 3.x", "dependencies": [ - { - "name": "mesa", - "default-features": false, - "features": [ - "opengl" - ] - } + "opengl" ] }, "llvm": { @@ -113,18 +107,6 @@ }, "offscreen": { "description": "Build with support for offscreen rendering (OSMesa)", - "dependencies": [ - { - "name": "mesa", - "default-features": false, - "features": [ - "opengl" - ] - } - ] - }, - "opengl": { - "description": "Build support for OpenGL (all versions)", "dependencies": [ "opengl" ] diff --git a/ports/symengine/portfile.cmake b/ports/symengine/portfile.cmake index efcb1fd8f1..c35dfb9ffd 100644 --- a/ports/symengine/portfile.cmake +++ b/ports/symengine/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO symengine/symengine - REF "v${VERSION}" - SHA512 91ea5d2d5b2b5ecbf7c3813bf2972a78384f7323ba328a556d7f8a2f54c39f44fceccd1465763a334df1b23f9031cbc87a8d930def0464345bb7fa271ecc508b + REF 450a0277e1116ab8c52582df9c77d42f9db3092a # unreleased version with LLVM 18 support + SHA512 fb9bfe3cf6d48051b86f28c749cfdc19a2d5c1fc750f3c45c422559e9b8b9736d1cb542af5023a876640d917ad2198b24385fd085d8e20ff97e7ee660e056605 HEAD_REF master ) diff --git a/ports/symengine/vcpkg.json b/ports/symengine/vcpkg.json index 5546c0bcf4..4b3a68c3b2 100644 --- a/ports/symengine/vcpkg.json +++ b/ports/symengine/vcpkg.json @@ -1,6 +1,7 @@ { "name": "symengine", "version": "0.11.2", + "port-version": 1, "description": "SymEngine is a fast symbolic manipulation library", "homepage": "https://github.com/symengine/symengine", "license": "BSD-3-Clause", diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 952f86b52a..7fcd2e7d7d 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -722,6 +722,7 @@ memorymodule:x64-android=fail # Missing dependent libraries. mesa:x64-linux=fail mesa:x64-osx=fail +mesa:arm64-osx=fail mfx-dispatch:arm-neon-android=fail mfx-dispatch:arm64-android=fail mfx-dispatch:x64-android=fail diff --git a/scripts/test_ports/vcpkg-ci-llvm/vcpkg.json b/scripts/test_ports/vcpkg-ci-llvm/vcpkg.json index afa1a3eb73..e5c34eae89 100644 --- a/scripts/test_ports/vcpkg-ci-llvm/vcpkg.json +++ b/scripts/test_ports/vcpkg-ci-llvm/vcpkg.json @@ -33,7 +33,7 @@ "polly", "utils" ], - "platform": "!static" + "platform": "!static & !x86" }, { "$comment": "Platform restriction due to CI artifact upload quirks; libc", diff --git a/versions/baseline.json b/versions/baseline.json index 4fdacf4787..714751200c 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3342,7 +3342,7 @@ }, "halide": { "baseline": "17.0.1", - "port-version": 0 + "port-version": 1 }, "happly": { "baseline": "2021-03-19", @@ -5405,8 +5405,8 @@ "port-version": 0 }, "llvm": { - "baseline": "17.0.2", - "port-version": 5 + "baseline": "18.1.6", + "port-version": 0 }, "lmdb": { "baseline": "0.9.31", @@ -5693,8 +5693,8 @@ "port-version": 3 }, "mesa": { - "baseline": "23.2.1", - "port-version": 1 + "baseline": "24.0.7", + "port-version": 0 }, "meschach": { "baseline": "1.2b", @@ -8526,7 +8526,7 @@ }, "symengine": { "baseline": "0.11.2", - "port-version": 0 + "port-version": 1 }, "systemc": { "baseline": "2.3.3", diff --git a/versions/h-/halide.json b/versions/h-/halide.json index abad7a9ddf..770d70204b 100644 --- a/versions/h-/halide.json +++ b/versions/h-/halide.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cdced195e1ecb05af078e7d0ba4ba58106397330", + "version": "17.0.1", + "port-version": 1 + }, { "git-tree": "b85a941fbb39b69cf6e9b508a826fc87a90ff722", "version": "17.0.1", diff --git a/versions/l-/llvm.json b/versions/l-/llvm.json index 03ea923e9b..068bf2b917 100644 --- a/versions/l-/llvm.json +++ b/versions/l-/llvm.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "895e2d7c7c902213125eeed97cc5cf7eebc99b9d", + "version": "18.1.6", + "port-version": 0 + }, { "git-tree": "3782c35ec8e69e728302f4adeb98dd21d7452fce", "version": "17.0.2", diff --git a/versions/m-/mesa.json b/versions/m-/mesa.json index abae0575c9..4dfe8646de 100644 --- a/versions/m-/mesa.json +++ b/versions/m-/mesa.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "24210567cde1f9242bca62ba46ef468467281c80", + "version": "24.0.7", + "port-version": 0 + }, { "git-tree": "cf4f628acb3c66d2c99544f1acd2a76f576f3f4b", "version": "23.2.1", diff --git a/versions/s-/symengine.json b/versions/s-/symengine.json index 1f00e46b1f..44a01dcc67 100644 --- a/versions/s-/symengine.json +++ b/versions/s-/symengine.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "2f4153bc257d5c8b657a7b37b6d4933aeb61573c", + "version": "0.11.2", + "port-version": 1 + }, { "git-tree": "22024db6e6ebc5f1be7e351e9eecd6f1cb26783a", "version": "0.11.2",