Skip to content

Backport: [WebAssembly] Don't stackify multi-def instructions (#200429) - #2

Merged
Arshia001 merged 1 commit into
mainfrom
fix/wide-arithmetic-overflow
Aug 6, 2026
Merged

Backport: [WebAssembly] Don't stackify multi-def instructions (#200429)#2
Arshia001 merged 1 commit into
mainfrom
fix/wide-arithmetic-overflow

Conversation

@kilyanni

@kilyanni kilyanni commented Aug 5, 2026

Copy link
Copy Markdown

Rebase and backport llvm#200429

Closes https://linear.app/wasmer/issue/ECO-421/builtin-mul-overflow-reports-overflow-for-valid-int64-multiplications

Header from Linear issue:

__builtin_mul_overflow appears to report overflow incorrectly for non-overflowing int64_t multiplications when compiling with wasixcc and running with wasmer, but only with -mwide-arithmetics enabled.

cc @marxin

This commit updates the `WebAssemblyRegStackify.cpp` pass to
specifically exclude attempting to stackify the first def of a multi-def
instruction. As the previous comments indicate this is possible to do in
some situations, but the current logic is incomplete and has led to
miscompilations such as llvm#98323 and llvm#199910. One option would be to make
the logic more robust, but in lieu of that in the meantime the change
here is to completely disable stackification in these situations. This
provides at least a "known working" base to build on later and fixes the
known regressions around this.

Closes llvm#98323
Closes llvm#199910

Backport to LLVM 21.1.2. Adapt the multivalue.ll REGS check to the older WebAssembly register-printer syntax.

(cherry picked from commit b472674)
@kilyanni kilyanni assigned Arshia001 and unassigned Arshia001 Aug 5, 2026
@kilyanni
kilyanni requested a review from Arshia001 August 5, 2026 14:39
@Arshia001
Arshia001 merged commit 98c00cb into main Aug 6, 2026
7 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.

4 participants