We want to disable dominance checks in unreachable code. The is_reachable() check for EBB parameter values was checking if the defining EBB was reachable, not the EBB using the value. This bug showed up in fuzzing and in #213.
46 lines
707 B
Plaintext
46 lines
707 B
Plaintext
test verifier
|
|
|
|
function %test() -> i32 { ; Ok
|
|
ebb0:
|
|
v0 = iconst.i32 0
|
|
v1 = iconst.i32 0
|
|
jump ebb2
|
|
|
|
ebb2:
|
|
jump ebb4
|
|
|
|
ebb4:
|
|
jump ebb2
|
|
|
|
ebb3(v2: i32):
|
|
v4 = iadd.i32 v1, v2
|
|
jump ebb9(v4)
|
|
|
|
ebb9(v7: i32):
|
|
v9 = iadd.i32 v2, v7
|
|
return v9
|
|
|
|
}
|
|
|
|
; Using a function argument in an unreachable block is ok.
|
|
function %arg(i32) -> i32 {
|
|
ebb0(v0: i32):
|
|
v1 = iadd_imm v0, 1
|
|
return v1
|
|
|
|
ebb1:
|
|
v10 = iadd_imm v0, 10
|
|
return v10
|
|
}
|
|
|
|
; Using an EBB argument from an unreachable block is not ok.
|
|
function %arg2(i32) -> i32 {
|
|
ebb0(v0: i32):
|
|
v1 = iadd v0, v10 ; error: uses value arg from non-dominating
|
|
return v1
|
|
|
|
ebb1(v10: i32):
|
|
v11 = iadd v0, v10
|
|
return v11
|
|
}
|