WebAssembly / WebAssembly/binaryen

List of missing peephole optimizations

Open
#1,764 62 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Is it possible doing some trivial logical simplifications for now? Or better wait souper with z3 solver for that?
like simplify from:

(func $test (export "test") (type $t0) (param $p0 i32) (result i32)
    get_local $p0
    i32.const 10
    i32.gt_s
    get_local $p0
    i32.const 10
    i32.eq
    i32.or)

to:

(func $test (export "test") (type $t0) (param $p0 i32) (result i32)
    get_local $p0
    i32.const 9
    i32.gt_s)

or:

(func $test (export "test") (type $t0) (param $p0 i32) (result i32)
    get_local $p0
    i32.const 10
    i32.ge_s)

DONE:
from:

  get_global $i
  i32.const 0
  i32.le_s
  i32.eqz
  if

to:

  get_global $i
  i32.const 0
  i32.gt_s
  if

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named. Start by reviewing the issue discussion and the existing optimization code to identify where these WAT patterns are handled, then define the supported simplifications and verify that the shown input produces the requested output.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.