WebAssembly / WebAssembly/binaryen

Speed up LocalGraph

Open
#1,338 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

src/ir/local-graph.h is fairly slow, and we should make it faster. If it were fast enough, we could enable precompute-propagate and merge-locals in more optimization levels, which would improve code output quality.

What LocalGraph does is scan a function and produce a mapping of the sets affecting each get. That is, for each get, the sets that reach that get, that their assigned value may be read there.

This is similar to SSA computation in a way, but simpler (no need to create phis), and there are fairly fast SSA computations on structured control flow like ours, so it seems like this could be fairly fast. Right now the implementation naively carries around big data structures needlessly.

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

Start with src/ir/local-graph.h and trace how LocalGraph scans functions and carries the sets reaching each get. Compare its data flow with fast SSA computation on structured control flow, as suggested in the issue. Done means LocalGraph is measurably faster enough to consider enabling precompute-propagate and merge-locals at more optimization levels.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.