From 228e150d8360c396aad4b9f64c5b9c1bc782db5f Mon Sep 17 00:00:00 2001 From: Jake Fecher Date: Tue, 2 Apr 2024 15:37:27 -0500 Subject: [PATCH] Revert "feat: improve SSA type-awareness in EQ and MUL instructions (#4691)" This reverts commit 669f1a0fa47ad9093888a8ce8e525cb02bcf19b5. --- .../src/ssa/ir/instruction/binary.rs | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa/ir/instruction/binary.rs b/compiler/noirc_evaluator/src/ssa/ir/instruction/binary.rs index e491807995b..36f3ae8620b 100644 --- a/compiler/noirc_evaluator/src/ssa/ir/instruction/binary.rs +++ b/compiler/noirc_evaluator/src/ssa/ir/instruction/binary.rs @@ -130,12 +130,6 @@ impl Binary { let zero = dfg.make_constant(FieldElement::zero(), operand_type); return SimplifyResult::SimplifiedTo(zero); } - if dfg.resolve(self.lhs) == dfg.resolve(self.rhs) - && dfg.get_value_max_num_bits(self.lhs) == 1 - { - // Squaring a boolean value is a noop. - return SimplifyResult::SimplifiedTo(self.lhs); - } } BinaryOp::Div => { if rhs_is_one { @@ -170,22 +164,6 @@ impl Binary { let one = dfg.make_constant(FieldElement::one(), Type::bool()); 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 {