diff --git a/src/ir/equiv.rs b/src/ir/equiv.rs index e92ce4d..7bfbec2 100644 --- a/src/ir/equiv.rs +++ b/src/ir/equiv.rs @@ -264,7 +264,7 @@ fn is_equiv_block_exit(lhs: &BlockExit, rhs: &BlockExit, map: &HashMap { - if condition != condition_other { + if !is_equiv_operand(condition, condition_other, map) { return false; } if !is_equiv_arg(arg_then, arg_then_other, map) { @@ -287,7 +287,7 @@ fn is_equiv_block_exit(lhs: &BlockExit, rhs: &BlockExit, map: &HashMap { - if value != value_other { + if !is_equiv_operand(value, value_other, map) { return false; } if !is_equiv_arg(default.deref(), default_other.deref(), map) { @@ -314,9 +314,14 @@ fn is_equiv_arg(lhs: &JumpArg, rhs: &JumpArg, map: &HashMap) - if map.get(&lhs.bid) != Some(&rhs.bid) { return false; } - if lhs.args != rhs.args { + if lhs.args.len() != rhs.args.len() { return false; } + for (l, r) in izip!(&lhs.args, &rhs.args) { + if !is_equiv_operand(l, r, map) { + return false; + } + } true }