Skip to content

Optimize eqz by general getFallthrough in computing condition #7558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

xuruiyang2002
Copy link
Contributor

Currently precompute doesn't do math computations with side-effect like seeing eqz(x) == 0 (x is 1 but has effect) and eqz(y) == 1 (y is 0 but has effect).

For example, it cannot replace

(local.tee $x
 (i32.const 1)
)

=>

(block
 (local.tee $x
  (i32.const 1)
 )
 (i32.const 1)
)

It only replaces entire expressions.

As discussed in #7492

-O3 --gufa -O3 -O3 has the same result as -O2, as does --flatten -O3. It is unfortunate that so much effort is needed. Yes, this should be improved.

So we let OptimizeInstructions to do more here.

Fixes: #7492

@xuruiyang2002
Copy link
Contributor Author

I've updated the comments as you suggested 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Emitting Zero] General rule might not handle unary eqz emitting zero bits well
2 participants