Repository navigation
[InstCombine] Fix 0.0 / x -> 0 folds when the divisor may be zero - #156
Merged
alexey-milovidov merged 1 commit intoNov 16, 2026
Merged
Conversation
…vm#202482) SimplifyDemandedUseFPClass folded 0/x to a signed zero, guarded only on the divisor being non-NaN. But when x==0, the result is is NaN, not 0! Require the divisor to be never (logical) zero, unless a NaN result isn't demanded. (cherry picked from commit bcb4e7d)
|
|
alexey-milovidov
merged commit Nov 16, 2026
2add44a
into
ClickHouse/release-23.x
7 of 8 checks passed
alexey-milovidov
added a commit
to ClickHouse/ClickHouse
that referenced
this pull request
Nov 16, 2026
… fix for illumos Advances the submodule to the tip of `ClickHouse/release-23.x`, which initializes the secret with `getentropy` on non-Linux platforms (ClickHouse/llvm-project#155, ClickHouse/llvm-project#157) and includes an `InstCombine` fix (ClickHouse/llvm-project#156). Co-Authored-By: Claude Opus 5.5 <[email protected]>
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-ClickHouse__ClickHouse
that referenced
this pull request
Nov 17, 2026
LLVM 23 `SimplifyDemandedUseFPClass` folded `+0.0 / x` to `copysign(0.0, x)` when `x` is known to be not NaN, ignoring that `0 / 0` is NaN. JIT-compiled expressions like `c0 * (0 / c0)` over an integer column returned `0` instead of `nan` for `c0 = 0` since the update to LLVM 23. Cherry-pick the upstream fix llvm/llvm-project#202482 into the fork: ClickHouse/llvm-project#156 Found by SQLancer (`Parallelism` oracle) on master: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=fdc4389b67de6aa94e602b884e1c403306184af7&name_0=NightlySQLancer&name_1=SQLancer%20%28arm_release%29 Caused by: ClickHouse#117346 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Cherry-pick of upstream llvm#202482 (commit
bcb4e7d061ac), which is not in upstreamrelease/23.x.SimplifyDemandedUseFPClassfolded+0.0 / xtocopysign(0.0, x)whenxis known to be not NaN, but0 / 0is NaN. The fold was added in llvm#175946 (LLVM 23 cycle).This miscompiles ClickHouse JIT-compiled expressions since the update to LLVM 23 (ClickHouse/ClickHouse#117346):
SELECT c0 * (0 / c0) FROM values('c0 Int32', 0) SETTINGS compile_expressions = 1, min_count_to_compile_expression = 0returns0instead ofnan, becausesitofpis never NaN but can be zero. Found by SQLancer (Parallelismoracle) on ClickHouse master. Verified with the ClickHouse build: with this patch the expression returnsnan.🤖 Generated with Claude Code