WebAssembly / WebAssembly/binaryen

Avoid extend/wrap to 64 bits when 32 are enough

Open
#5,004 1 comment 0 reactions 1 assignee View on GitHub

@kripken is already working on this.

Since Sep 6, 2022.

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

Description

E.g.

(i32.wrap_i64
 (i64.add
  (i64.extend_i32_u
   (local.get $0)
  )
  (i64.const 8)
 )
)
 =->
(i32.add
 (local.get $0)
 (i32.const 8)
)

This is an example of a more general rule: we could avoid extending and wrapping if the work in the middle will not matter after the wrapping.

Found by the superoptimizer #4994 (for comparison to other findings: rule #0, benefit 1560922).

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.