From 34c6d8e695cec23d219f759760bce566389b78e2 Mon Sep 17 00:00:00 2001 From: Ary Borenszweig Date: Fri, 7 Nov 2025 14:47:21 -0300 Subject: [PATCH] Revert "feat(ACIR): reuse element_type_sizes blocks with the same structure (#10231)" This reverts commit 7fb2f1a26b9c04860e24f018eb528a9a84e0f055. --- compiler/noirc_evaluator/src/acir/arrays.rs | 10 +--------- compiler/noirc_evaluator/src/acir/mod.rs | 5 ----- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/compiler/noirc_evaluator/src/acir/arrays.rs b/compiler/noirc_evaluator/src/acir/arrays.rs index bd16b771975..8c2c1e69b1a 100644 --- a/compiler/noirc_evaluator/src/acir/arrays.rs +++ b/compiler/noirc_evaluator/src/acir/arrays.rs @@ -881,14 +881,8 @@ impl Context<'_> { AcirValue::Array(values) => { let flat_elem_type_sizes = calculate_element_type_sizes_array(values); - // If there's already a block with these same sizes, reuse it. It's fine do to so - // because the element type sizes array is never mutated. - if let Some(block_id) = self.type_sizes_to_blocks.get(&flat_elem_type_sizes) { - return Ok(*block_id); - } - // The final array should will the flattened index at each outer array index - let init_values = vecmap(flat_elem_type_sizes.clone(), |type_size| { + let init_values = vecmap(flat_elem_type_sizes, |type_size| { let var = self.acir_context.add_constant(type_size); AcirValue::Var(var, NumericType::NativeField) }); @@ -899,8 +893,6 @@ impl Context<'_> { Some(AcirValue::Array(init_values.into())), )?; - self.type_sizes_to_blocks.insert(flat_elem_type_sizes, element_type_sizes); - Ok(element_type_sizes) } diff --git a/compiler/noirc_evaluator/src/acir/mod.rs b/compiler/noirc_evaluator/src/acir/mod.rs index e5bf00d116f..cac0b3c7b76 100644 --- a/compiler/noirc_evaluator/src/acir/mod.rs +++ b/compiler/noirc_evaluator/src/acir/mod.rs @@ -91,10 +91,6 @@ struct Context<'a> { /// which utilizes this internal memory for ACIR generation. element_type_sizes_blocks: HashMap, BlockId>, - /// Maps type sizes to BlockId. This is used to reuse the same BlockId if different - /// non-homogenous arrays end up having the same type sizes layout. - type_sizes_to_blocks: HashMap, BlockId>, - /// Number of the next BlockId, it is used to construct /// a new BlockId max_block_id: u32, @@ -129,7 +125,6 @@ impl<'a> Context<'a> { initialized_arrays: HashSet::default(), memory_blocks: HashMap::default(), element_type_sizes_blocks: HashMap::default(), - type_sizes_to_blocks: HashMap::default(), max_block_id: 0, data_bus: DataBus::default(), shared_context,