Skip to content

Optimize block tails where a dropped br_if's value is redundant #7506

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 17 commits into
base: main
Choose a base branch
from

Conversation

xuruiyang2002
Copy link
Contributor

If a block ends with a br_if followed by a value that is the same as the br_if's value (and has no side effects), the value of br_if and br_if itself are redundant and can be removed. For example:

(block $block (result i32)
 ..
 (drop
  (br_if $block
   (value)
   (condition)
  )
 )
 (value)
)

=>

(block $block (result i32)
 ..
 (drop
  (condition)
 )
 (value)
)

Fixes: #7489

@xuruiyang2002
Copy link
Contributor Author

Thanks! Learned a lot from your comments and good coding taste. I've updated 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.

[Unhoisted] [Binary] [Might not fallthrough] load & store order affects the constant propagation in binaryOp
2 participants