KGrewal1 edited PR #11790.
KGrewal1 updated PR #11790.
KGrewal1 commented on PR #11790:
will run
cargo +nightly fuzz run differentialand see if it spots anything too
KGrewal1 edited a comment on PR #11790:
will run
cargo +nightly fuzz run differentialand see if it spots anything too
- OOMd on my machine before it found anything...
github-actions[bot] commented on PR #11790:
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>
alexcrichton submitted PR review.
alexcrichton created PR review comment:
How come this was removed? Was this an incorrect optimization?
KGrewal1 submitted PR review.
KGrewal1 created PR review comment:
Yes - in combination with the urem const optimization led to optimizing imin rem -1 to 0 instead of having it trap which it should
alexcrichton submitted PR review.
alexcrichton created PR review comment:
Ah that's actually a point where Rust and WebAssembly differ. Rust panicks on
i32::MIN % -1while WebAssembly returns 0. CLIF's semantics generally follow wasms, so I believe that this is still a correct optimization.
KGrewal1 submitted PR review.
KGrewal1 created PR review comment:
Is that sufficient for CLIF (I guess at the least could cause issues in the rust cranelift backend if this occurs)?
alexcrichton submitted PR review.
alexcrichton created PR review comment:
I'm not really sure what you mean by your question?
Regardless this isn't something we can really change. Wasm
i32.rem_sis directly translated to a CLIFsreminstruction. The CLIF instruction needs to mach the wasm instruction as a result, where the semantics of wasm is thati32::MIN % -1is 0.
cfallin submitted PR review.
cfallin created PR review comment:
@KGrewal1 I don't think we'll cause problems for
cg_clifif we definesremto work with Wasm's semantics: we're defining it over a superset of the domain that Rust expects. Because other ISAs also work this way (e.g. aarch64 does not trap at all in divide/remainder operations), Rust already needs to reify its trapping semantics at a higher level; so the IR produced bycg_clifmust necessarily contain the logic to panic oni32::MIN % -1, but that's already the case.
KGrewal1 updated PR #11790.
KGrewal1 updated PR #11790.
KGrewal1 updated PR #11790.
alexcrichton submitted PR review.
alexcrichton merged PR #11790.
Last updated: Dec 06 2025 at 07:03 UTC