Repository navigation
Use llvm-project release-23.x - #116787
thevar1able wants to merge 11 commits into
Conversation
Rebased ClickHouse patches from `ClickHouse/release-22.x` onto upstream `release/23.x` (llvmorg-23.1.0+3). Dropped patches that were merged upstream: the `ProgramStack.cpp` include fix and the `unordered_map` copy-constructor node-leak fix with its follow-ups. CMake adaptation: - Synced LLVM per-component source lists with 23.x (renames like `X86VZeroUpper.cpp` -> `X86InsertVZeroUpper.cpp`, `ExpandMemCmp.cpp` moved from CodeGen to Scalar, new TableGen `MatchTable/` files, etc.) - Added `tsan_adaptive_delay.cpp` and `sanitizer_unwind_aix.cpp` to compiler-rt source lists - Added `text_encoding.cpp` to libcxx sources - Bumped bundled LLVM version macros to 23.1.0
- Compile libcxx `text_encoding.cpp` with `-std=c++26` (`std::text_encoding` is a C++26 feature; upstream builds libcxx sources with a newer standard) - Add new LLVM 23 tablegen outputs: `X86GenSDNodeInfo.inc`, `X86GenPostLegalizeGICombiner.inc`, `IntrinsicsAVR.h`, and the `-gisel-extended-llt` flag for `AArch64GenGlobalISel.inc` - Generate `InstrumentorVariables.inc` needed by the new `Instrumentor` pass in `LLVMipo` - Handle `[[nodiscard]]` on `try_lock_for` in `ProfiledLocks.h` (newly annotated in libc++ 23) - Add missing includes no longer provided transitively by libc++ 23: `<atomic>` in Poco JSON `Array.h`, `<cstdlib>` in rocksdb (submodule bump), `<array>` in Jieba-CPP (submodule bump)
|
Workflow [PR], commit [77c09f0] Summary: ❌
AI ReviewSummaryThis PR bumps the bundled Findings❌ Blockers
Tests
Final Verdict❌ Changes required before merge. |
There was a problem hiding this comment.
For some reason, the comparison does not open on GitHub.
There was a problem hiding this comment.
🕵 Fixed in da3ff93. Both contrib/Jieba-CPP (407ba0a…) and contrib/rocksdb (bbb9bc2…) were accidental gitlink moves unrelated to the LLVM bump, pointing at commits that do not exist in the repositories configured in .gitmodules — hence the comparison did not open on GitHub and Checkout Submodules failed, dropping every other job. Both are restored to the pointers on master; contrib/llvm-project is now the only submodule this branch bumps. Also merged master (which required taking its deletion of StorageWindowView.cpp).
There was a problem hiding this comment.
For some reason, the comparison does not open on GitHub.
That is expected, because I didn't create forks and didn't push changes.
alexey-milovidov
left a comment
There was a problem hiding this comment.
Everything else LGTM.
|
|
||
| # X86 Info sources | ||
| set(LLVMX86INFO_SOURCES | ||
| ${LLVM_SOURCE_DIR}/lib/Target/X86/GISel/X86PostLegalizerCombiner.cpp |
There was a problem hiding this comment.
X86PostLegalizerCombiner.cpp is an X86CodeGen source upstream, and X86MCLFIRewriter.cpp is an X86Desc source. In the active combined list they are both being archived into LLVMX86Info, while _llvm still exposes LLVMX86Info, LLVMX86Desc, and LLVMX86CodeGen as separate static libraries.
That makes the x86 target build rely on duplicate-library/link-order behavior instead of the declared component graph: new codegen/MC symbols now live in the earlier LLVMX86Info archive. Please move them to the same buckets as the split files and upstream layout: X86PostLegalizerCombiner.cpp under LLVMX86CODEGEN_SOURCES, and X86MCLFIRewriter.cpp under LLVMX86DESC_SOURCES.
|
|
||
| # AArch64 Utils sources (needed by both Desc and CodeGen) | ||
| set(LLVMAARCH64UTILS_SOURCES | ||
| ${LLVM_SOURCE_DIR}/lib/Target/AArch64/AArch64CodeLayoutOpt.cpp |
There was a problem hiding this comment.
These five files are not AArch64Utils upstream: AArch64CodeLayoutOpt.cpp, AArch64PerfectShuffle.cpp, AArch64SRLTDefineSuperRegs.cpp, and SVEShuffleOpts.cpp stay in AArch64CodeGen, while AArch64MCLFIRewriter.cpp belongs to AArch64Desc. Putting them into LLVMAARCH64UTILS_SOURCES means the active combined build archives codegen/desc objects into the lightweight helper bucket that ClickHouse later folds into LLVMAArch64Desc.
The current CI matrix can still pass if the final link line happens to repeat the dependent archives, but the component graph is now wrong and link-order-dependent. LLVMAARCH64UTILS_SOURCES should stay just AArch64BaseInfo.cpp; please move the new files into the matching LLVMAARCH64DESC_SOURCES / LLVMAARCH64CODEGEN_SOURCES sections.
|
|
||
| # RISCV Info sources | ||
| set(LLVMRISCVINFO_SOURCES | ||
| ${LLVM_SOURCE_DIR}/lib/Target/RISCV/GISel/RISCVInlineAsmLowering.cpp |
There was a problem hiding this comment.
RISCVInlineAsmLowering.cpp and RISCVQCRelaxMarking.cpp are both RISCVCodeGen sources upstream, but here they are being archived into LLVMRISCVInfo.
That strips the new LLVM 23 RISC-V codegen pieces out of the active LLVMRISCVCodeGen bucket and again makes link success depend on duplicate static-library ordering instead of the declared component split. Please move both files under LLVMRISCVCODEGEN_SOURCES.
|
|
||
| # PowerPC Info sources | ||
| set(LLVMPOWERPCINFO_SOURCES | ||
| ${LLVM_SOURCE_DIR}/lib/Target/PowerPC/PPCPrepareIFuncsOnAIX.cpp |
There was a problem hiding this comment.
PPCPrepareIFuncsOnAIX.cpp is a PowerPC codegen pass upstream, not target-info. Adding it to LLVMPOWERPCINFO_SOURCES means the new pass now lives in the earlier LLVMPowerPCInfo archive instead of LLVMPowerPCCodeGen.
That is the same link-order-dependent component drift as the other target lists in this patch. Please move it under LLVMPOWERPCCODEGEN_SOURCES.
|
|
||
| # LoongArch Info sources | ||
| set(LLVMLOONGARCHINFO_SOURCES | ||
| ${LLVM_SOURCE_DIR}/lib/Target/LoongArch/LoongArchTargetObjectFile.cpp |
There was a problem hiding this comment.
LoongArchTargetObjectFile.cpp is part of upstream LoongArchCodeGen, and LoongArchTargetMachine.cpp constructs LoongArchELFTargetObjectFile from it. Putting that source into LLVMLOONGARCHINFO_SOURCES moves a codegen implementation into the earlier info archive instead of the active LLVMLoongArchCodeGen one.
CI can still stay green if the final link line repeats LLVMLoongArchInfo, but the component graph is wrong and brittle. Please move LoongArchTargetObjectFile.cpp under LLVMLOONGARCHCODEGEN_SOURCES.
clang-tidy 23 flags `.get()->` on smart pointers (`readability-redundant-smartptr-get`) in more contexts, and libc++ 23 makes `std::string` iterators raw pointers, so `begin().base()` no longer compiles in `gtest_compressionCodec`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=116787&sha=da3ff9339cf7c2a77486aca83edd682a26824bb2&name_0=PR&name_1=Build%20%28arm_tidy%29 PR: #116787 Co-Authored-By: Claude Fable 5 <[email protected]>
da3ff93 to
53d5f99
Compare
|
Needs amosbird/Jieba-CPP#1. |
…x commits Same LLVM 23 include fixes (`<cstdlib>` in rocksdb `stderr_logger`, `<array>` in `jieba_hmm_seg`), re-authored with the work email and pushed to reachable branches: `ClickHouse/v10.10.1` in `ClickHouse/rocksdb` and `clickhouse-submodule` in `thevar1able/Jieba-CPP`. Co-Authored-By: Claude Fable 5 <[email protected]>
In `release/23.x`, `GlobalISelMatchTable.cpp` was split into
`Common/GlobalISel/MatchTable/{MatchTable,Matchers,Types}.cpp`, and
`lib/Support/APFloat.cpp` now includes `shared/math.h` from the `libc`
project, so `${LLVM_SOURCE_DIR}/../libc` must be on the include path
(matching upstream `LLVMSupport`).
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116787&sha=45de7279e5046c978ae85a97330864dcef89b327&name_0=PR&name_1=Build%20%28amd_binary%29
#116787
Co-Authored-By: Claude Fable 5 <[email protected]>
`PACKAGE_VERSION` is embedded into DWARF producer strings via `AsmPrinter`, so keep it in sync with the bundled LLVM version. Co-Authored-By: Claude Fable 5 <[email protected]>
| ${CMAKE_CURRENT_BINARY_DIR}/include | ||
| ${LLVM_SOURCE_DIR}/utils/TableGen | ||
| ${LLVM_SOURCE_DIR}/../third-party/siphash/include | ||
| ${LLVM_SOURCE_DIR}/../libc |
There was a problem hiding this comment.
This only fixes the external native-tblgen project used when CMAKE_CROSSCOMPILING=ON. Native builds still go through the in-tree llvm-min-tblgen / llvm-tblgen definitions in contrib/llvm-project-cmake/CMakeLists.txt, and those targets still compile ${LLVMSUPPORT_SOURCES} without ${LLVM_SOURCE_DIR}/../libc in their include dirs (target_include_directories at lines 426-431 and 574-579).
LLVM 23 lib/Support/APFloat.cpp now unconditionally includes shared/math.h from libc, so a native LLVM-enabled build is still one clean build away from the same missing-header failure. Please add the same ${LLVM_SOURCE_DIR}/../libc include path to the in-tree tablegen targets too.
Build profile diff (arm_release)Comparing Binary sizes
The official master build is compiled with Object file sizes
|
| Object file | Master | PR | Δ |
|---|---|---|---|
src/Functions/CMakeFiles/clickhouse_functions_obj.dir/FunctionsNumericIndexedVector.cpp.o |
33.70 MiB | 34.55 MiB | +880.06 KiB (+2.55%) |
contrib/llvm-project-cmake/CMakeFiles/LLVMVectorize.dir/__/llvm-project/llvm/lib/Transforms/Vectori… |
2.62 MiB | 3.23 MiB | +620.66 KiB (+23.10%) |
contrib/llvm-project-cmake/CMakeFiles/llvm-tblgen.dir/__/llvm-project/llvm/utils/TableGen/Common/Gl… |
new | 528.88 KiB | +528.88 KiB |
contrib/llvm-project-cmake/CMakeFiles/LLVMipo.dir/__/llvm-project/llvm/lib/Transforms/IPO/Instrumen… |
new | 483.29 KiB | +483.29 KiB |
src/CMakeFiles/dbms.dir/DataTypes/Serializations/SerializationMap.cpp.o |
2.18 MiB | 1.71 MiB | -477.96 KiB (-21.44%) |
contrib/llvm-project-cmake/CMakeFiles/LLVMVectorize.dir/__/llvm-project/llvm/lib/Transforms/Vectori… |
1.14 MiB | 1.59 MiB | +463.10 KiB (+39.68%) |
src/Functions/CMakeFiles/clickhouse_functions_obj.dir/divide.cpp.o |
14.39 MiB | 14.71 MiB | +324.66 KiB (+2.20%) |
src/Dictionaries/CMakeFiles/clickhouse_dictionaries.dir/HashedDictionary.cpp.o |
22.09 MiB | 22.40 MiB | +320.02 KiB (+1.41%) |
src/Functions/CMakeFiles/clickhouse_functions_obj.dir/modulo.cpp.o |
25.38 MiB | 25.68 MiB | +312.79 KiB (+1.20%) |
contrib/llvm-project-cmake/CMakeFiles/LLVMCodeGen.dir/__/llvm-project/llvm/lib/CodeGen/Rematerializ… |
new | 260.60 KiB | +260.60 KiB |
contrib/llvm-project-cmake/CMakeFiles/LLVMAArch64CodeGen.dir/__/llvm-project/llvm/lib/Target/AArch6… |
616.25 KiB | 366.91 KiB | -249.34 KiB (-40.46%) |
src/Dictionaries/CMakeFiles/clickhouse_dictionaries.dir/HashedArrayDictionary.cpp.o |
8.17 MiB | 8.40 MiB | +229.11 KiB (+2.74%) |
src/Functions/CMakeFiles/clickhouse_functions_obj.dir/midpoint.cpp.o |
7.07 MiB | 7.28 MiB | +218.64 KiB (+3.02%) |
src/CMakeFiles/dbms.dir/Core/Settings.cpp.o |
3.40 MiB | 3.61 MiB | +212.91 KiB (+6.11%) |
src/Functions/CMakeFiles/clickhouse_functions_obj.dir/avg2.cpp.o |
7.09 MiB | 7.29 MiB | +208.20 KiB (+2.87%) |
contrib/llvm-project-cmake/CMakeFiles/LLVMAArch64CodeGen.dir/__/llvm-project/llvm/lib/Target/AArch6… |
291.38 KiB | 497.80 KiB | +206.42 KiB (+70.84%) |
contrib/llvm-project-cmake/CMakeFiles/LLVMTargetParser.dir/__/llvm-project/llvm/lib/TargetParser/AM… |
new | 200.71 KiB | +200.71 KiB |
contrib/llvm-project-cmake/CMakeFiles/LLVMAArch64Desc.dir/__/llvm-project/llvm/lib/Target/AArch64/U… |
342.50 KiB | 146.61 KiB | -195.89 KiB (-57.19%) |
src/Functions/CMakeFiles/clickhouse_functions_obj.dir/intDiv.cpp.o |
15.45 MiB | 15.64 MiB | +194.68 KiB (+1.23%) |
contrib/llvm-project-cmake/CMakeFiles/LLVMVectorize.dir/__/llvm-project/llvm/lib/Transforms/Vectori… |
122.96 KiB | 311.05 KiB | +188.08 KiB (+152.96%) |
727 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.
Compile time of recompiled translation units ⚠️
12077 translation units recompiled, 30421 s compile time in total, 4336 of them have a recent master baseline.
Translation units without a recent master baseline:
contrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_round.cc: 29.7 scontrib/llvm-project-cmake/__/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp: 28.1 scontrib/llvm-project-cmake/__/llvm-project/llvm/lib/Passes/PassBuilder.cpp: 24.2 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_temporal_binary.cc: 23.4 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_temporal_unary.cc: 21.4 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/scalar_arithmetic.cc: 18.9 scontrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp: 17.1 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/vector_swizzle.cc: 16.0 scontrib/grpc-cmake/__/grpc/src/core/ext/transport/chttp2/transport/http2_server_transport.cc: 15.3 scontrib/llvm-project-cmake/__/llvm-project/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp: 15.2 scontrib/grpc-cmake/__/grpc/src/core/ext/transport/chttp2/transport/http2_client_transport.cc: 14.5 scontrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-glue/source/GlueClient1.cpp: 14.4 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/aggregate_basic.cc: 14.2 scontrib/hive-metastore-cmake/__/hive-metastore/ThriftHiveMetastore.cpp: 14.2 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/vector_sort.cc: 13.9 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/builder.cc: 13.7 scontrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-glue/source/GlueClient.cpp: 13.7 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/vector_select_k.cc: 13.7 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/compute/kernels/hash_aggregate.cc: 13.7 scontrib/arrow-cmake/__/arrow/cpp/src/arrow/scalar.cc: 13.6 s- ... and 218 more
Symbol sizes
| Binary | Symbol | Master | PR | Δ |
|---|---|---|---|---|
programs/clickhouse |
llvm::AArch64MCRegisterClassStorage |
new | 203.23 KiB | +203.23 KiB |
programs/clickhouse-keeper |
llvm::AArch64MCRegisterClassStorage |
new | 203.23 KiB | +203.23 KiB |
programs/clickhouse |
llvm::InlineFunctionImpl(llvm::CallBase&, llvm::InlineFunctionInfo&, bool, llvm::AAResults*, bool, … |
82.31 KiB | removed | -82.31 KiB (-100.00%) |
programs/clickhouse-keeper |
llvm::InlineFunctionImpl(llvm::CallBase&, llvm::InlineFunctionInfo&, bool, llvm::AAResults*, bool, … |
82.25 KiB | removed | -82.25 KiB (-100.00%) |
programs/clickhouse |
llvm::InlineFunctionImpl(llvm::CallBase&, llvm::InlineFunctionInfo&, bool, llvm::AAResults*, bool, … |
new | 64.38 KiB | +64.38 KiB |
programs/clickhouse-keeper |
llvm::InlineFunctionImpl(llvm::CallBase&, llvm::InlineFunctionInfo&, bool, llvm::AAResults*, bool, … |
new | 64.36 KiB | +64.36 KiB |
programs/clickhouse-keeper |
_ZNSt3__1L18__contention_tableE |
new | 64.00 KiB | +64.00 KiB |
programs/clickhouse |
_ZNSt3__1L18__contention_tableE |
new | 64.00 KiB | +64.00 KiB |
\`llvm::ConstantInt::get(type, -1)\` implicitly truncates the sign-extended value to the target width. LLVM 23 asserts that the value is representable in the given bit width (\`APInt.h:127\`), so JIT compilation of \`groupBitAnd\` aborted in debug builds for types narrower than 64 bits. Use \`llvm::Constant::getAllOnesValue\` instead, which is exact for any width. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116787&sha=24ff9d93a336ff032a847bf46bb704bae2cea4a9&name_0=PR&name_1=Stateless%20tests%20(amd_debug,%20parallel) PR: #116787 Co-Authored-By: Claude Fable 5 <[email protected]>
`llvm::ConstantInt::get(type, -1)` implicitly truncates the sign-extended value to the target width. LLVM 23 asserts that the value is representable in the given bit width (`APInt.h:127`), so JIT compilation of `groupBitAnd` aborted in debug builds for types narrower than 64 bits. Use `llvm::Constant::getAllOnesValue` instead, which is exact for any width. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116787&sha=24ff9d93a336ff032a847bf46bb704bae2cea4a9&name_0=PR&name_1=Stateless%20tests%20(amd_debug,%20parallel) PR: #116787 Co-Authored-By: Claude Fable 5 <[email protected]>
With libc++ 23 headers, clang started inlining `getDataArrayAt` — including its exception-construction path — into every call site. Across ~3600 `BSINumericIndexedVector` template instantiations this bloated `FunctionsNumericIndexedVector.cpp.o` by ~2 MiB and nearly doubled its compile time (the build profile diff flagged +6% object size, and locally the TU went from 74 s to 134 s). Moving the `throw` into a `[[noreturn]] NO_INLINE` helper restores both: 76 s and most of the size (measured with clang 22.1.8, identical flags, only the libc++ headers swapped). Report: #116787 (comment) PR: #116787 Co-Authored-By: Claude Fable 5 <[email protected]>
c55004d to
a15aff3
Compare
| endif() | ||
|
|
||
| set (LLVM_VERSION "22.1.1bundled") | ||
| set (LLVM_VERSION "23.1.0bundled") |
There was a problem hiding this comment.
LLVM 23 lib/Support/APFloat.cpp now includes shared/math.h from ../libc, and the generic add_llvm_library helper below still gives every LLVM target only ${LLVM_INCLUDE_DIRS}. LLVMSupport itself is built through that helper and still compiles ${LLVMSUPPORT_SOURCES} (which includes APFloat.cpp), so fixing only the external native-tblgen project leaves a clean native LLVM-enabled build broken at the normal LLVMSupport target too.
Please add ${LLVM_SOURCE_DIR}/../libc to LLVM_INCLUDE_DIRS (or inject it from add_llvm_library) so every target that compiles LLVMSUPPORT_SOURCES gets the same include root, not just the external tablegen project.
clang-tidy 23 flags `.get()->` on smart pointers (`readability-redundant-smartptr-get`) in more contexts, and libc++ 23 makes `std::string` iterators raw pointers, so `begin().base()` no longer compiles in `gtest_compressionCodec`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=116787&sha=da3ff9339cf7c2a77486aca83edd682a26824bb2&name_0=PR&name_1=Build%20%28arm_tidy%29 PR: #116787 Co-Authored-By: Claude Fable 5 <[email protected]>
In `release/23.x`, `GlobalISelMatchTable.cpp` was split into
`Common/GlobalISel/MatchTable/{MatchTable,Matchers,Types}.cpp`, and
`lib/Support/APFloat.cpp` now includes `shared/math.h` from the `libc`
project, so `${LLVM_SOURCE_DIR}/../libc` must be on the include path
(matching upstream `LLVMSupport`).
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116787&sha=45de7279e5046c978ae85a97330864dcef89b327&name_0=PR&name_1=Build%20%28amd_binary%29
#116787
Co-Authored-By: Claude Fable 5 <[email protected]>
`llvm::ConstantInt::get(type, -1)` implicitly truncates the sign-extended value to the target width. LLVM 23 asserts that the value is representable in the given bit width (`APInt.h:127`), so JIT compilation of `groupBitAnd` aborted in debug builds for types narrower than 64 bits. Use `llvm::Constant::getAllOnesValue` instead, which is exact for any width. CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=116787&sha=24ff9d93a336ff032a847bf46bb704bae2cea4a9&name_0=PR&name_1=Stateless%20tests%20(amd_debug,%20parallel) PR: #116787 Co-Authored-By: Claude Fable 5 <[email protected]>
With libc++ 23 headers, clang started inlining `getDataArrayAt` — including its exception-construction path — into every call site. Across ~3600 `BSINumericIndexedVector` template instantiations this bloated `FunctionsNumericIndexedVector.cpp.o` by ~2 MiB and nearly doubled its compile time (the build profile diff flagged +6% object size, and locally the TU went from 74 s to 134 s). Moving the `throw` into a `[[noreturn]] NO_INLINE` helper restores both: 76 s and most of the size (measured with clang 22.1.8, identical flags, only the libc++ headers swapped). Report: #116787 (comment) PR: #116787 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Superseded by #117346 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Use
llvm-projectrelease-23.x.Workflow [PR]
Sync PR [sync-upstream/pr/116787]