-
Notifications
You must be signed in to change notification settings - Fork 232
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(ssa): Globals DIE #7081
feat(ssa): Globals DIE #7081
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 👇
|
Execution Report
|
Compilation Report
|
Compilation Memory Report
|
Execution Memory Report
|
pub(crate) fn dead_instruction_elimination( | ||
&mut self, | ||
insert_out_of_bounds_checks: bool, | ||
) -> HashSet<ValueId> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some explanation to the docstrings about the new return value? Are the globals the only reasonable thing to return here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will add some comments. We do not need anything but the used globals as all other values are going to be per function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment
Generally looks good to me, some nits. I think it's worth merging this into the other SSA globals PR due to the compilation speed regressions in there that are solved by this one |
Yeah agreed. I will wait for all comments to be resolved before merging into #7021 |
Description
Problem*
Resolves #7021 (comment)
Summary*
DIE for globals is a little bit more funky as we do not have a mutable instructions vector as part of a block. We could do this but I would like to move away from re-using the entire Function/DataFlowGraph construct for globals which are much simpler than our functions.
We also want to account for numeric constants among our unused globals as declaring them in Brillig gen comes with a cost. Our current DIE only looks at instruction results, but we want to look at both instruction results and values representing constants.
Additional Context
I don't expect this PR to fully revert the regressions we see in #7021 due to the overhead for the global initialization call/return.
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.