pujitha24 opened PR #14795 from pujitha24:auto/issue-14694 to bytecodealliance:main:
Report: https://github.com/bytecodealliance/wasmtime/issues/14694
Narrow (i8/i16)
sdiv/udivby a constant non-power-of-two divisor were left as trapping skeleton instructions, so they were not removed even when the result was unused (i32/i64 already were, via the magic-number rewrite). This extends i8/i16 operands to i32, reuses the i32 magic sequence, and reduces the result.Validated with
cargo test -p cranelift-filetests,cargo test -p cranelift-codegen, and new egraph and run tests (run on this aarch64 machine; x86_64/s390x/riscv64 targets in the run test were not executed here). Divisors of -1 and powers of two are excluded, so theINT_MIN / -1trap is unchanged.I used an AI tool to help with this change and reviewed it myself.
This PR was written in part with the assistance of generative AI.
Fixes #14694
pujitha24 requested alexcrichton for a review on PR #14795.
pujitha24 requested wasmtime-compiler-reviewers for a review on PR #14795.
github-actions[bot] added the label cranelift on PR #14795.
github-actions[bot] added the label isle on PR #14795.
github-actions[bot] commented on PR #14795:
Subscribe to Label Action
cc @avanhatt, @cfallin, @fitzgen, @mmcloughlin
<details>
This issue or pull request has been labeled: "cranelift", "isle"Thus the following users have been cc'd because of the following labels:
- avanhatt: isle
- cfallin: isle
- fitzgen: isle
- mmcloughlin: isle
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
:thumbs_up: alexcrichton submitted PR review:
Thanks!
alexcrichton added PR #14795 cranelift: Simplify i8/i16 division by constants via i32 to the merge queue.
:check: alexcrichton merged PR #14795.
alexcrichton removed PR #14795 cranelift: Simplify i8/i16 division by constants via i32 from the merge queue.
Last updated: Oct 31 2026 at 23:03 UTC