Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Do not duplicate constant arrays in brillig #6155

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions compiler/noirc_evaluator/src/ssa/ir/function_inserter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::ssa::ir::types::Type;
use super::{
basic_block::BasicBlockId,
dfg::{CallStack, InsertInstructionResult},
function::{Function, RuntimeType},
function::Function,
instruction::{Instruction, InstructionId},
value::ValueId,
};
Expand Down Expand Up @@ -46,14 +46,7 @@ impl<'f> FunctionInserter<'f> {
if let Some(fetched_value) =
self.const_arrays.get(&(new_array.clone(), typ.clone()))
{
// Arrays in ACIR are immutable, but in Brillig arrays are copy-on-write
// so for function's with a Brillig runtime we make sure to check that value
// in our constants array map matches the resolved array value id.
if matches!(self.function.runtime(), RuntimeType::Acir(_)) {
return *fetched_value;
} else if *fetched_value == value {
return value;
}
return *fetched_value;
};

let new_array_clone = new_array.clone();
Expand Down
Loading