Skip to content

[SLP]Fix detection of matching splat vector (backport to 20.x) - #70

Merged
vchuravy merged 1 commit into
JuliaLang:julia-release/20.xfrom
vchuravy:vc/backport-slp-splat-20.x
Dec 4, 2026
Merged

vchuravy merged 1 commit into
JuliaLang:julia-release/20.xfrom
vchuravy:vc/backport-slp-splat-20.x

Conversation

@vchuravy

Copy link
Copy Markdown
Member

Backport of llvm/llvm-project@4ea57b3 (fixes llvm#135113) to julia-release/20.x.

When SLP emits a zero-element splat it may reuse an existing splat shuffle of the same width. It only checked that both were zero-element splats, not that the existing one defines every lane the requested mask needs. A 3-lane splat padded to 4 lanes (<0, 0, 0, poison>) could therefore be reused where all 4 lanes are live, propagating poison into the result.

This is the cause of the wrong floating-point results on Julia 1.13 reported in JuliaLang/julia#65136. Running opt -passes=slp-vectorizer on the pre-SLP IR of that reproducer shows the bad splat with LLVM 20.1.2 and 20.1.8, and not with 19.1.7, 21.1.8 or 22.1.8. The fix is in release/21.x and later but was never backported to release/20.x.

The source change applied cleanly. The regression test does not exist on this branch (upstream added it separately in llvm/llvm-project@396e2ef3b7f4), so the whole file is added here in its post-fix form.

Not yet verified: I have not finished building this branch, so the test's CHECK lines (generated against main at the time) have not been run against 20.x, and the Julia reproducer has not been re-run with the patched LLVM.

After merging, this needs a new julia-20.1.8-* tag and an LLVM bump on Julia release-1.13.

This backport and description were prepared with Claude Code; the human author has not yet read or reviewed them.

🤖 Generated with Claude Code

Need to check, that the mask of the potentially matching splat node is
not less defined than the requested mask to avoid poison propagation and
incorrect code.

Fixes llvm#135113

(cherry picked from commit 4ea57b3)

[Backport: the regression test does not exist on this branch (upstream added it separately in 396e2ef), so the whole file is added here in its post-fix form.]

Assisted-by: Claude Code (Claude Fable 5)
@vchuravy
vchuravy merged commit 9f1fe29 into JuliaLang:julia-release/20.x Dec 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants