Repository navigation
Cherry pick #98882 to 26.3: Use llvm-project 22.1.1 - #122872
Merged
Merged
Conversation
Update the `contrib/llvm-project` submodule from LLVM 21 (release/21.x) to LLVM 22 (release/22.x). All 11 ClickHouse-specific patches were cherry-picked onto the new `ClickHouse/release-22.x` branch in the fork; the e2k `config.guess` patch was already upstream and skipped. Changes in the main repo: - Bump `LLVM_VERSION` to `22.1.1bundled` - Add `_LIBCPP_ASSERTION_SEMANTIC_DEFAULT` to `__config_site` (new requirement in LLVM 22 hardening framework) - Remove `common_constants.cpp` from `libllvmlibc` sources (moved to header-only in LLVM 22) Assisted-by: Claude Opus 4.6 via GitHub Copilot
LLVM 22 libc++ removed transitive includes that older versions provided. Code relying on `<map>` being transitively included now needs an explicit include. Assisted-by: Claude Opus 4.6 via GitHub Copilot
- `StorageFile.cpp`: suppress `[[nodiscard]]` warning on `fs::canonical` called only for its side-effect (throwing if file does not exist) - `StorageMergeTree.cpp`: suppress thread-safety analysis on `movePartitionToTable` where `std::lock` + `std::adopt_lock` pattern for two mutexes is correct but opaque to the analyzer Assisted-by: Claude Opus 4.6 via GitHub Copilot
LLVM 22 libc++ removed implicit `operator==` synthesis for types that only define `operator!=`. The `TEnumIterator` class in thrift 0.16.0 only had `operator!=`, causing build failures with the new `__tree::__insert_range_unique` that requires `operator==`. Upstream fixed this in apache/thrift PR #2633 (THRIFT-5603), included in v0.22.0. Cherry-picked the ClickHouse locale patch (`std::locale::classic()` instead of `std::locale("C")`) on top. Assisted-by: Claude Opus 4.6 via GitHub Copilot
- `Intrinsic::getDeclaration` renamed to `Intrinsic::getOrInsertDeclaration` in LLVM 22 (abs.cpp, bitCount.cpp) - `createTargetMachine` first argument changed from `StringRef` to `const Triple&` — construct `llvm::Triple` explicitly (CHJIT.cpp) - `std::__gcd` internal removed from libc++ — use `std::gcd` from `<numeric>` (AggregateFunctionKolmogorovSmirnovTest.cpp) - Added `(void)` casts for new `[[nodiscard]]` on `std::stod`, `std::filesystem::is_directory`, and `future.get()` (KQLGeneralFunctions.cpp, LocalServer.cpp, ZooKeeperRemoveByList.cpp, EphemeralLockInZooKeeper.cpp) Assisted-by: Claude Opus 4.6 via GitHub Copilot
Construct DataTypeQBit on the stack instead of using std::make_shared, avoiding the unused-result warning on the discarded shared_ptr.
The LLVM 22 libc++ upgrade changed std::unordered_map behavior such that a copy no longer preserves iteration order. This exposed two latent bugs in the text index prewhere machinery: 1. `IndexReadTasks` (`std::unordered_map`) is copied into `MergeTreeReadPoolBase` and then iterated independently in `getPrewhereActions` / `getReadTaskColumns`. When the copy has a different iteration order, prewhere readers and actions get paired by index incorrectly, producing either LOGICAL_ERROR (column count mismatch) or ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER (String in a filter position). Fixed by switching to `std::map` for deterministic order. 2. The `MergeTreeRangeReader` constructor executed prewhere step actions on `result_sample_block` for `None`-type steps (text index read steps), but `executePrewhereActionsAndFilterColumns` skips them at runtime. This caused the sample block column order to diverge from the actual data, leading to wrong query results when two text indexes are present. Fixed by skipping action execution on the sample block for `None`-type steps, matching the runtime behavior.
Use `llvm-project` 22.1.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #98882
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job