Skip to content

Commit

Permalink
Add equality check to value merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jfecher committed Apr 5, 2024
1 parent 66835da commit 849062a
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ impl<'a> ValueMerger<'a> {
"Expected values merged to be of the same type but found {then_type} and {else_type}"
);

// Don't merge two values if they're already equal. That can make them non-constant
if then_value == else_value {
return then_value;
}

let then_call_stack = self.dfg.get_value_call_stack(then_value);
let else_call_stack = self.dfg.get_value_call_stack(else_value);

Expand Down

0 comments on commit 849062a

Please sign in to comment.