-
Notifications
You must be signed in to change notification settings - Fork 831
Closed as not planned
Description
So far we have been using sequences of br_ifs to hint to Binaryen that these might be suitable candidates for a br_table if conditions are dense constants potentially. While this works well, there are occasions where it is easier / more idiomatic to emit sequences of normal ifs, either manually or using the Reloopers addBranch, but these don't benefit from RemoveUnusedBrs's tablify. Typical code is:
(local.set $0 (...))
(if
(i32.or
(i32.or
(i32.eq
(local.get $0)
(i32.const 1)
)
(i32.eq
(local.get $0)
(i32.const 2)
)
)
(i32.eq
(local.get $0)
(i32.const 3)
)
)
(if
...
(call ...)
)
(call ...) ;; or unreachable
)or
(local.set $0 (...))
(if
(i32.or
(i32.or
(i32.eq
(local.get $0)
(i32.const 1)
)
(i32.eq
(local.get $0)
(i32.const 2)
)
)
(i32.eq
(local.get $0)
(i32.const 3)
)
)
(return
(call ...)
)
)
(if
...
(return
(call ...)
)
)
(call ...) ;; or unreachablewhere at some point converting to a br_table seems to become more efficient.
Metadata
Metadata
Assignees
Labels
No labels