Skip to content

Extend getMaxbits to handle Block type #7590

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

@xuruiyang2002 xuruiyang2002 commented May 14, 2025

There is a need to extend the getMaxBits to handle the Block.

For example, wasm-opt (95808a7) cannot optimize the following code snippet

   (i32.and
    (i32.load
     (i32.const 0)
    )
    (block (result i32)
     (i32.store
      (i32.const 0)
      (i32.const 0)
     )
     (i32.const 0)
    )

to zero, the root cause is that getMaxBits fails to deal with the block.

Fixes: #7559

@xuruiyang2002
Copy link
Contributor Author

xuruiyang2002 commented May 14, 2025

Current PR is to just implement the getMaxBits for Block.

As discussed in #7559, should we bother to introduce the getFallthrough? In doing so, we'd also modify the API and the references and tests. What's more, invoking getFallthrough maybe prohibited. Because bits.h is included by properties.h before the getFallthrough function itself is defined within properties.h, which thus making it invisible at the point of the call.

@xuruiyang2002
Copy link
Contributor Author

xuruiyang2002 commented May 14, 2025

UPDATE: I've fuzzing for about three hour, and all is well.

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.

getMaxBits fails to analyze Block expression, missing i32.and -> 0 optimization
1 participant