Skip to content

Commit

Permalink
feat: optimize array ops for arrays of structs
Browse files Browse the repository at this point in the history
  • Loading branch information
sirasistant committed Jan 12, 2024
1 parent bc9a44f commit 9c4dd53
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2431,8 +2431,7 @@ impl Context {
}
}

// We can omit the element size array for arrays which have elements of size 1 and do not contain slices.
// TODO: remove restriction on size 1 elements.
// We can omit the element size array for arrays which don't contain arrays or slices.
fn can_omit_element_sizes_array(array_typ: &Type) -> bool {
if array_typ.contains_slice_element() {
return false;
Expand All @@ -2441,5 +2440,5 @@ fn can_omit_element_sizes_array(array_typ: &Type) -> bool {
panic!("ICE: expected array type");
};

types.len() == 1 && types[0].flattened_size() == 1
!types.iter().any(|typ| typ.contains_an_array())
}

0 comments on commit 9c4dd53

Please sign in to comment.