-
Notifications
You must be signed in to change notification settings - Fork 786
RemoveUnusedBrs: optimize unreachable control flow mixed with side-effecting branches #7639
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
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
BTW: fuzzing for about one hour, and no bad news. |
) | ||
) | ||
) | ||
(loop $in1 | ||
(block $out1 | ||
(br_if $out1 | ||
(i32.const 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this one, and others below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wait, I was reading the old diff, sorry...
(local.tee $0 ;; but here it is *not* ok | ||
(i32.const -7) | ||
) | ||
(local.get $0) ;; but here it is *not* ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This local.tee
was important, to add side effects. You can change this to a local.tee
of a local.get
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, and updated.
Currently wasm-opt cannot optimize unused branch complexed with side-effect operations, such as
Actually, the whole block can be removed. However, O3 cannot optimize it (while O2 could).
Fixes: #7637