Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions compiler/noirc_evaluator/src/ssa/ir/instruction/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,6 @@ impl Binary {
return SimplifyResult::SimplifiedTo(one);
}

if operand_type.is_unsigned() {
// If we're comparing a variable against a constant value which lies outside of the range of
// values which the variable's type can take, we can assume that the equality will be false.
let constant = lhs.or(rhs);
let non_constant = if lhs.is_some() { self.rhs } else { self.lhs };
if let Some(constant) = constant {
let max_possible_value =
2u128.pow(dfg.get_value_max_num_bits(non_constant)) - 1;
if constant > max_possible_value.into() {
let zero = dfg.make_constant(FieldElement::zero(), Type::bool());
return SimplifyResult::SimplifiedTo(zero);
}
}
}

if operand_type == Type::bool() {
// Simplify forms of `(boolean == true)` into `boolean`
if lhs_is_one {
Expand Down