Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Nov 14, 2024
1 parent 0598720 commit 0ccd743
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,15 @@ fn simplify_slice_push_back(
let len_equals_capacity = dfg
.insert_instruction_and_results(len_equals_capacity_instr, block, None, call_stack.clone())
.first();
let len_not_equals_capacity_instr = Instruction::Not(len_equals_capacity);
let len_not_equals_capacity = dfg
.insert_instruction_and_results(
len_not_equals_capacity_instr,
block,
None,
call_stack.clone(),
)
.first();

let new_slice_length = update_slice_length(arguments[0], dfg, BinaryOp::Add, block);

Expand Down Expand Up @@ -431,7 +440,7 @@ fn simplify_slice_push_back(
let mut value_merger =
ValueMerger::new(dfg, block, &mut slice_sizes, unknown, None, call_stack);

let new_slice = value_merger.merge_values(len_equals_capacity, new_slice, set_last_slice_value);
let new_slice = value_merger.merge_values(len_not_equals_capacity, set_last_slice_value, new_slice);

SimplifyResult::SimplifiedToMultiple(vec![new_slice_length, new_slice])
}
Expand Down

0 comments on commit 0ccd743

Please sign in to comment.