emturner opened PR #11931 from trilitech:emturner/fix-div-const to bytecodealliance:main:
Closes #11927
When
opt_level="speed" || opt_level="speed_and_size",i32::MIN/i32::MINandi64::MIN/i64::MINboth give-1instead of1.The signed
x / drule whendis a power of two was too broad in it's constraints: namely that it accidentally picked upty::MINtoo - which should have instead triggered the rule for signed division by a negative power of two.The tests in
sdiv.clifconst tests added in f678260bb3b2fa07ae10737f581b2d395d3349da unfortunately missed this edge case. Even if the edge case had been tested for, however, the test would have passed - as it seems thesdiv.cliftest file was tested withopt_level=nonebefore.
emturner requested wasmtime-compiler-reviewers for a review on PR #11931.
emturner requested cfallin for a review on PR #11931.
emturner updated PR #11931.
emturner commented on PR #11931:
We had a go at fixing the issue in
i64_is_negative_power_of_twoby taking an additionalTypeparameter - but struggling with partial rules at that point.
github-actions[bot] commented on PR #11931:
Subscribe to Label Action
cc @cfallin, @fitzgen
<details>
This issue or pull request has been labeled: "cranelift", "isle"Thus the following users have been cc'd because of the following labels:
- cfallin: isle
- fitzgen: isle
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
cfallin submitted PR review:
Thanks!
cfallin merged PR #11931.
Last updated: Dec 06 2025 at 06:05 UTC