emscripten-core / emscripten-core/emscripten

Wasm2JS redundant x + 0 operations

Open
#13,362 3 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Building https://github.com/juj/wasm_webgpu/commit/4c2600b0f6549f95fe9251cba629c935fbc74ba8 clear_screen sample for testing WebGPU on Wasm2JS, I notice the following kind of statements appear:

```js
$3 = (.6666666666666666 - $2) * 6 + 0;
$3 = $2 * 6 + 0;
$3 = (.6666666666666666 - $2) * 6 + 0;
$3 = $2 * 6 + 0;
$3 = (.6666666666666666 - $0) * 6 + 0;
$3 = $0 * 6 + 0;
```

It seems that it would be feasible to optimize away those `+ 0` additions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.