You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently mem2reg is used to promote const-indexed array store/loads to registers, to the end that such array allocations can be removed. However, arrays appearing in parameters to main are treated as a special case (regardless of whether they are dynamic or const indexed). As a result we need to maintain extra code in ACIR gen for converting these const-index array parameters to main into ACIR.
The main argument for this special treatment is that were it the case that an array param to main were indexed dynamically, the effects of the mem2reg pass would be complex to reason through.
Happy Case
Once dynamic arrays have been implemented for the SSA refactor, it may be worth returning to review whether or not it simplifies matters to remove this special edge-case.
Alternatives Considered
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered:
with the dynamic array implementation, handling of const-index array operations are required in acir-gen anyways, so we do not need to maintain extra code for array arguments of main.
I did not see any special case dedicated to main array arguments in mem2reg. As parameters to the first block, they are assigned an unknown value because the first block has no predecessor.
Closing this as outdated. We used to use mutable arrays internally which required the mem2reg pass to track gets/sets to each index. We've since moved to immutable arrays so that they may be simplified anywhere and mem2reg is no longer concerned with them (apart from tracking arrays which store references).
Problem
Currently mem2reg is used to promote const-indexed array store/loads to registers, to the end that such array allocations can be removed. However, arrays appearing in parameters to main are treated as a special case (regardless of whether they are dynamic or const indexed). As a result we need to maintain extra code in ACIR gen for converting these const-index array parameters to main into ACIR.
The main argument for this special treatment is that were it the case that an array param to main were indexed dynamically, the effects of the mem2reg pass would be complex to reason through.
Happy Case
Once dynamic arrays have been implemented for the SSA refactor, it may be worth returning to review whether or not it simplifies matters to remove this special edge-case.
Alternatives Considered
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: