Inline jump tables in parsed br_table instructions (#5755)

As jump tables are used by at most one br_table instruction, inline their definition in those instructions instead of requiring them to be declared as function-level metadata.
This commit is contained in:
Trevor Elliott
2023-02-09 14:24:04 -08:00
committed by GitHub
parent 202d3af16a
commit 15fe9c7c93
23 changed files with 54 additions and 200 deletions

View File

@@ -7,10 +7,8 @@ target s390x
target riscv64
function %br_table_i32(i32) -> i32 {
jt0 = jump_table [block1, block2, block2, block3]
block0(v0: i32):
br_table v0, block4, jt0
br_table v0, block4, [block1, block2, block2, block3]
block1:
v1 = iconst.i32 1
@@ -46,17 +44,15 @@ block5(v5: i32):
; RISC-V had a bug where having a br_table on a cold block would cause a segfault
; See #5496 for more details.
function %br_table_cold_block(i32) -> i32 system_v {
jt0 = jump_table []
block0(v0: i32):
jump block1
block1 cold:
br_table v0, block2, jt0
br_table v0, block2, []
block2:
v1 = iconst.i32 0
return v1
}
; run: %br_table_cold_block(0) == 0
; run: %br_table_cold_block(1) == 0
; run: %br_table_cold_block(1) == 0