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

feat(performance): Avoid extra Brillig array offsetting for constant indices #7522

Merged
merged 18 commits into from
Feb 26, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix some tests
vezenovm committed Feb 21, 2025
commit 132d626a98b420602f43665af9117fcbed9fc02a
Original file line number Diff line number Diff line change
@@ -767,7 +767,7 @@ impl<'block, Registers: RegisterAllocator> BrilligBlock<'block, Registers> {

let index_variable = self.convert_ssa_single_addr_value(*index, dfg);

// Slice validation should be generated separately against its dynamic lengthl
// Slice validation should be generated separately against its dynamic length
if !dfg.is_safe_brillig_index(*index, *array) && matches!(dfg.type_of_value(*array), Type::Array(..)) {
self.validate_array_index(array_variable, index_variable);
}
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa.rs
Original file line number Diff line number Diff line change
@@ -222,8 +222,8 @@ fn optimize_all(builder: SsaBuilder, options: &SsaEvaluatorOptions) -> Result<Ss
.run_pass(Ssa::brillig_entry_point_analysis, "Brillig Entry Point Analysis")
// Remove any potentially unnecessary duplication from the Brillig entry point analysis.
.run_pass(Ssa::remove_unreachable_functions, "Removing Unreachable Functions (3rd)")
.run_pass(Ssa::dead_instruction_elimination, "Dead Instruction Elimination (2nd)")
.run_pass(Ssa::brillig_array_gets, "Brillig Array Get Optimizations")
.run_pass(Ssa::dead_instruction_elimination, "Dead Instruction Elimination (2nd)")
.finish())
}

1 change: 0 additions & 1 deletion compiler/noirc_evaluator/src/ssa/opt/brillig_array_gets.rs
Original file line number Diff line number Diff line change
@@ -61,7 +61,6 @@ impl Function {
1u128
} else {
3u128
// continue;
};
let index = self.dfg.make_constant(
index_constant + offset.into(),