Skip to content

Commit 3392629

Browse files
authored
chore: pull value merger code from sync (#10080)
Please read [contributing guidelines](CONTRIBUTING.md) and remove this line.
1 parent 9440c1c commit 3392629

File tree

9 files changed

+143
-222
lines changed

9 files changed

+143
-222
lines changed

barretenberg/cpp/src/barretenberg/bb/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ std::string honk_vk_to_json(std::vector<bb::fr>& data)
136136
}
137137

138138
/**
139-
* @brief Proves and Verifies an ACIR circuit
139+
* @brief Proves and verifies an ACIR circuit
140140
*
141141
* Communication:
142142
* - proc_exit: A boolean value is returned indicating whether the proof is valid.

noir/noir-repo/compiler/noirc_evaluator/src/ssa/ir/instruction.rs

+8-19
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,7 @@ pub(crate) enum Instruction {
272272
///
273273
/// Where we save the result of !then_condition so that we have the same
274274
/// ValueId for it each time.
275-
IfElse {
276-
then_condition: ValueId,
277-
then_value: ValueId,
278-
else_condition: ValueId,
279-
else_value: ValueId,
280-
},
275+
IfElse { then_condition: ValueId, then_value: ValueId, else_value: ValueId },
281276

282277
/// Creates a new array or slice.
283278
///
@@ -524,14 +519,11 @@ impl Instruction {
524519
assert_message: assert_message.clone(),
525520
}
526521
}
527-
Instruction::IfElse { then_condition, then_value, else_condition, else_value } => {
528-
Instruction::IfElse {
529-
then_condition: f(*then_condition),
530-
then_value: f(*then_value),
531-
else_condition: f(*else_condition),
532-
else_value: f(*else_value),
533-
}
534-
}
522+
Instruction::IfElse { then_condition, then_value, else_value } => Instruction::IfElse {
523+
then_condition: f(*then_condition),
524+
then_value: f(*then_value),
525+
else_value: f(*else_value),
526+
},
535527
Instruction::MakeArray { elements, typ } => Instruction::MakeArray {
536528
elements: elements.iter().copied().map(f).collect(),
537529
typ: typ.clone(),
@@ -590,10 +582,9 @@ impl Instruction {
590582
| Instruction::RangeCheck { value, .. } => {
591583
f(*value);
592584
}
593-
Instruction::IfElse { then_condition, then_value, else_condition, else_value } => {
585+
Instruction::IfElse { then_condition, then_value, else_value } => {
594586
f(*then_condition);
595587
f(*then_value);
596-
f(*else_condition);
597588
f(*else_value);
598589
}
599590
Instruction::MakeArray { elements, typ: _ } => {
@@ -756,7 +747,7 @@ impl Instruction {
756747
None
757748
}
758749
}
759-
Instruction::IfElse { then_condition, then_value, else_condition, else_value } => {
750+
Instruction::IfElse { then_condition, then_value, else_value } => {
760751
let typ = dfg.type_of_value(*then_value);
761752

762753
if let Some(constant) = dfg.get_numeric_constant(*then_condition) {
@@ -775,13 +766,11 @@ impl Instruction {
775766

776767
if matches!(&typ, Type::Numeric(_)) {
777768
let then_condition = *then_condition;
778-
let else_condition = *else_condition;
779769

780770
let result = ValueMerger::merge_numeric_values(
781771
dfg,
782772
block,
783773
then_condition,
784-
else_condition,
785774
then_value,
786775
else_value,
787776
);

noir/noir-repo/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -443,12 +443,8 @@ fn simplify_slice_push_back(
443443
let mut value_merger =
444444
ValueMerger::new(dfg, block, &mut slice_sizes, unknown, None, call_stack);
445445

446-
let new_slice = value_merger.merge_values(
447-
len_not_equals_capacity,
448-
len_equals_capacity,
449-
set_last_slice_value,
450-
new_slice,
451-
);
446+
let new_slice =
447+
value_merger.merge_values(len_not_equals_capacity, set_last_slice_value, new_slice);
452448

453449
SimplifyResult::SimplifiedToMultiple(vec![new_slice_length, new_slice])
454450
}

noir/noir-repo/compiler/noirc_evaluator/src/ssa/ir/printer.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,11 @@ fn display_instruction_inner(
209209
Instruction::RangeCheck { value, max_bit_size, .. } => {
210210
writeln!(f, "range_check {} to {} bits", show(*value), *max_bit_size,)
211211
}
212-
Instruction::IfElse { then_condition, then_value, else_condition, else_value } => {
212+
Instruction::IfElse { then_condition, then_value, else_value } => {
213213
let then_condition = show(*then_condition);
214214
let then_value = show(*then_value);
215-
let else_condition = show(*else_condition);
216215
let else_value = show(*else_value);
217-
writeln!(
218-
f,
219-
"if {then_condition} then {then_value} else if {else_condition} then {else_value}"
220-
)
216+
writeln!(f, "if {then_condition} then {then_value} else {else_value}")
221217
}
222218
Instruction::MakeArray { elements, typ } => {
223219
write!(f, "make_array [")?;

0 commit comments

Comments
 (0)