Skip to content

Commit 4aa5fbe

Browse files
authored
Fix overly strict fused_cmp_branch condition (#1975)
fix overly strict fused_cmp_branch condition
1 parent 81140c2 commit 4aa5fbe

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

  • crates/wasmi/src/engine/translator/func

crates/wasmi/src/engine/translator/func/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,14 +1471,13 @@ impl FuncTranslator {
14711471
// - immediates cannot be the result of a previous instruction.
14721472
return Ok(None);
14731473
};
1474-
if staged_ty != condition_ty {
1475-
// Case: cannot fuse if staged type and condition type do not match.
1476-
return Ok(None);
1474+
match (RegKind::new(staged_ty), RegKind::new(condition_ty)) {
1475+
(Some(RegKind::Ireg), Some(RegKind::Ireg)) => {}
1476+
_ => {
1477+
// Case: cannot fuse if staged and condition accumulators do not match.
1478+
return Ok(None);
1479+
}
14771480
}
1478-
debug_assert!(
1479-
RegKind::Ireg.matches_ty(condition_ty),
1480-
"unexpected condition type: {condition_ty:?}"
1481-
);
14821481
let cmp_op = match negate {
14831482
false => staged_op,
14841483
true => match staged_op.negate_cmp_instr() {

0 commit comments

Comments
 (0)