feat(ssa): Prune dead block parameters#8239
Conversation
Changes to Brillig bytecode sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to number of Brillig opcodes executed
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
|
Looks like the last failing test is in the debugger. The debugger is most likely keeping the bad overflowing instruction in use, thus we error out vs. normal execution. This PR should still be fine to review. I will add this as an exception to the debugger tests as we do in fact expect an error here with the debugger then. |
|
Thoughts on just including this as part of the DIE pass? |
|
This would also make it easier to trigger another round of DIE if necessary. |
I wanted the pruning to be separate from the DIE logic, but you raise a good point that it is simpler to have them combined. I'll merge the passes (while still keeping the param pruning separate). |
|
I think we can still keep it relatively separate but if we're always calling this immediately after DIE then it probably makes sense to have a "DIE+block params" pass which calls the two sub-passes internally. This also makes it easier for us to pass the state without having to pass it up into the dfg and down again. |
Yeah I decided to go with turning DIE into a "DIE+block params" pass. However, for passing the state I still find it a bit cleaner to simply attach the unused parameters onto the |
compiler/noirc_evaluator/src/ssa/opt/die/prune_dead_parameters.rs
Outdated
Show resolved
Hide resolved
compiler/noirc_evaluator/src/ssa/opt/die/prune_dead_parameters.rs
Outdated
Show resolved
Hide resolved
compiler/noirc_evaluator/src/ssa/opt/die/prune_dead_parameters.rs
Outdated
Show resolved
Hide resolved
I would prefer for us to pass this state around outside of the DFG as it prevents something which is now internal to this new SSA pass leaking into the global SSA state. |
Co-authored-by: jfecher <jfecher11@gmail.com>
…g of unused params per block
compiler/noirc_evaluator/src/ssa/opt/die/prune_dead_parameters.rs
Outdated
Show resolved
Hide resolved
…rameters state as to split it out from die
Description
Problem*
Resolves #8237, #8229
Summary*
We now remove dead block parameters and update the respective predecessor terminators. This was done as follows:
Additional Context
Partially resolves #8233 except for the minimum inliner setting #8233 (comment). Perhaps we are ok with that though as ACIR cannot be run with a different inliner setting either way. So for the same inliner setting they do in fact still match.
I could add #8233 as a regression test and just override the minimum inliner setting if we do view this as matching execution.
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.