Closed as not planned
Description
So far we have been using sequences of br_if
s 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 if
s, either manually or using the Relooper
s 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 unreachable
where at some point converting to a br_table
seems to become more efficient.
Metadata
Metadata
Assignees
Labels
No labels