cranelift: Restrict br_table to i32 indices (#4510)
* cranelift: Restrict `br_table` to `i32` indices In #4498 it was proposed that we should only accept `i32` indices to `br_table`. The rationale for this is that larger types lead the users to a false sense of flexibility (since we don't support jump tables larger than u32's), and narrower types are not well tested paths that would be safer if we removed them. * cranelift: Reduce directly from i128 to i32 in Switch
This commit is contained in:
@@ -2,30 +2,30 @@ test compile precise-output
|
||||
set unwind_info=false
|
||||
target aarch64
|
||||
|
||||
function %f(i64) -> i64 {
|
||||
function %f(i32) -> i32 {
|
||||
jt0 = jump_table [block1, block2, block3]
|
||||
|
||||
block0(v0: i64):
|
||||
block0(v0: i32):
|
||||
br_table v0, block4, jt0
|
||||
|
||||
block1:
|
||||
v1 = iconst.i64 1
|
||||
v1 = iconst.i32 1
|
||||
jump block5(v1)
|
||||
|
||||
block2:
|
||||
v2 = iconst.i64 2
|
||||
v2 = iconst.i32 2
|
||||
jump block5(v2)
|
||||
|
||||
block3:
|
||||
v3 = iconst.i64 3
|
||||
v3 = iconst.i32 3
|
||||
jump block5(v3)
|
||||
|
||||
block4:
|
||||
v4 = iconst.i64 4
|
||||
v4 = iconst.i32 4
|
||||
jump block5(v4)
|
||||
|
||||
block5(v5: i64):
|
||||
v6 = iadd.i64 v0, v5
|
||||
block5(v5: i32):
|
||||
v6 = iadd.i32 v0, v5
|
||||
return v6
|
||||
}
|
||||
|
||||
@@ -54,6 +54,5 @@ block5(v5: i64):
|
||||
; block8:
|
||||
; b label9
|
||||
; block9:
|
||||
; add x0, x0, x5
|
||||
; add w0, w0, w5
|
||||
; ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user