diff --git a/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs b/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs index f7e2d7df93..d1031c9855 100644 --- a/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs +++ b/compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs @@ -774,7 +774,15 @@ fn operator_result_max_bit_size_to_truncate( match op { Add => Some(std::cmp::max(lhs_bit_size, rhs_bit_size) + 1), Subtract => Some(std::cmp::max(lhs_bit_size, rhs_bit_size) + 1), - Multiply => Some(lhs_bit_size + rhs_bit_size), + Multiply => { + if lhs_bit_size == 1 || rhs_bit_size == 1 { + // Truncation is unnecessary as multiplication by a boolean value cannot cause an overflow. + None + } else { + Some(lhs_bit_size + rhs_bit_size) + } + } + ShiftLeft => { if let Some(rhs_constant) = dfg.get_numeric_constant(rhs) { // Happy case is that we know precisely by how many bits the the integer will