Skip to content

Commit

Permalink
feat(perf): Simplify the cfg after DIE (#6184)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

Part of general effort to reduce Brillig bytecode sizes.

## Summary\*

While working other SSA opts, I noticed in a couple tests we had
simplified blocks down to only their terminator, but those empty blocks
still existed in our final SSA. It looks to be due to previous passes,
and specifically DIE simplifying down to an empty block which was not
caught in the initial CFG simplification.

I pushed this PR wanted to see how much of a benefit simplifying at the
end would be across our tests. It is a whole extra SSA pass, however, of
all our passes, simplify CFG shouldn't be very heavy and wouldn't be too
bad to run again if it provides decent benefits.

## 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\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
vezenovm authored Oct 1, 2024
1 parent 85c502c commit a1b5046
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions compiler/noirc_evaluator/src/ssa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ pub(crate) fn optimize_into_acir(
.run_pass(Ssa::remove_enable_side_effects, "After EnableSideEffectsIf removal:")
.run_pass(Ssa::fold_constants_using_constraints, "After Constraint Folding:")
.run_pass(Ssa::dead_instruction_elimination, "After Dead Instruction Elimination:")
.run_pass(Ssa::simplify_cfg, "After Simplifying:")
.run_pass(Ssa::array_set_optimization, "After Array Set Optimizations:")
.finish();

Expand Down

0 comments on commit a1b5046

Please sign in to comment.