Fix missing modification of jump table in licm

This commit is contained in:
Y-Nak
2020-05-14 22:20:24 +09:00
committed by Yoshitomo Nakanishi
parent 2cec20aa57
commit 855a6374dd
5 changed files with 109 additions and 21 deletions

View File

@@ -0,0 +1,19 @@
test compile
set opt_level=speed_and_size
target x86_64
function %br_table_opt() {
jt0 = jump_table [block1, block2]
block0:
v0 = iconst.i32 1
br_table v0, block2, jt0
block1:
return
block2:
v1 = iconst.i32 1
jump block2
}

View File

@@ -0,0 +1,28 @@
test licm
target aarch64
function %rewrite_jump_table() {
jt0 = jump_table [block1, block2]
block0:
v0 = iconst.i64 1
v1 = jump_table_base.i64 jt0
v2 = jump_table_entry.i64 v0, v1, 4, jt0
v3 = iadd v1, v2
indirect_jump_table_br v3, jt0
block1:
return
block2:
v4 = bconst.b1 false
jump block2
}
; sameln: function
; nextln: jt0 = jump_table [block1, block3]
; check: block3:
; nextln: v4 = bconst.b1 false
; nextln: jump block2
; check: block2:
; nextln: jump block2