Skip to content

Commit 68f3022

Browse files
authored
fix: Do not duplicate constant arrays in brillig (#6155)
# Description ## Problem\* Avoids array duplication in inserter for brillig runtimes. ## Summary\* After #6122 the inhibitor in the deduplication process for brillig should not be necessary anymore. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
1 parent bcb438b commit 68f3022

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

compiler/noirc_evaluator/src/ssa/ir/function_inserter.rs

+2-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::ssa::ir::types::Type;
55
use super::{
66
basic_block::BasicBlockId,
77
dfg::{CallStack, InsertInstructionResult},
8-
function::{Function, RuntimeType},
8+
function::Function,
99
instruction::{Instruction, InstructionId},
1010
value::ValueId,
1111
};
@@ -46,14 +46,7 @@ impl<'f> FunctionInserter<'f> {
4646
if let Some(fetched_value) =
4747
self.const_arrays.get(&(new_array.clone(), typ.clone()))
4848
{
49-
// Arrays in ACIR are immutable, but in Brillig arrays are copy-on-write
50-
// so for function's with a Brillig runtime we make sure to check that value
51-
// in our constants array map matches the resolved array value id.
52-
if matches!(self.function.runtime(), RuntimeType::Acir(_)) {
53-
return *fetched_value;
54-
} else if *fetched_value == value {
55-
return value;
56-
}
49+
return *fetched_value;
5750
};
5851

5952
let new_array_clone = new_array.clone();

0 commit comments

Comments
 (0)