jameshu15869 opened PR #12135 from claby2:main to bytecodealliance:main:
Collaborators: @claby2 @bisheshank
Cranelift may generate code where a
selectfollowed by anicmpcan be directly substituted with theselectinstruction's condition. Specifically, we can perform this optimization when we encounter code of the form... v1 = select v0, k1, k2 v2 = icmp eq v1, k1 ...Here, we can optimize to
v2 = v0given thatk1andk2are constants.In the language of the example above, this PR handles
icmp eqandicmp newhenk1ork2are theicmpcondition. We use the ISLE rewriteicmp ne x 0as a "cast" to handle the case where the inner condition of theselectis not restricted to 0 or 1 (Seenon_icmp_innerin issue-11578-semantics.clif)Fixes #11578
jameshu15869 requested wasmtime-compiler-reviewers for a review on PR #12135.
jameshu15869 requested cfallin for a review on PR #12135.
Last updated: Dec 13 2025 at 19:03 UTC