Stream: git-wasmtime

Topic: wasmtime / PR #13458 egraph: peer through ireduce in brif...


view this post on Zulip Wasmtime GitHub notifications bot (May 22 2026 at 20:00):

ggreif opened PR #13458 from ggreif:gabor/ireduce-ctz-clz-peephole to bytecodealliance:main:

Extends #13343's simplify_skeleton fold so the existing
brif (ctz X) / brif (clz X) rules also fire when an ireduce
(i.e. i32.wrap_i64 at the wasm level) sits between the count and
the branch.

Why this matters: non-Rust frontends targeting wasm-EOP often emit
i64.ctz; i32.wrap_i64; br_if for boolean-context LSB tests. The
wrap is harmless (the count is in [0, 64]) but it currently blocks
the fold, so cranelift falls back to materializing the full count
before the branch. With this PR, the i64-wrap form lowers to the
same testq \$1, %rdx; je shape as the i32 case.

Test coverage mirrors the existing patterns:

Source pattern in the wild: motoko/moc's EOP peephole
(motoko PR #6117)
emits exactly \`i64.ctz; i32.wrap_i64; br_if\` for
\`(value & 1) == 0\`-as-branch-condition.

view this post on Zulip Wasmtime GitHub notifications bot (May 22 2026 at 20:00):

ggreif requested cfallin for a review on PR #13458.

view this post on Zulip Wasmtime GitHub notifications bot (May 22 2026 at 20:00):

ggreif requested wasmtime-compiler-reviewers for a review on PR #13458.

view this post on Zulip Wasmtime GitHub notifications bot (May 22 2026 at 20:00):

ggreif requested wasmtime-core-reviewers for a review on PR #13458.


Last updated: Jun 01 2026 at 09:49 UTC