Intraprocedural SROA
Includes intraprocedural SROA optimization (and a small fix to the editor to handle creating and deleting the same node using the same editor, but in different edits).
A few notes about implementation not detailed in #8 (closed):
- For function arguments and returns of products, we add code that rebuilds the product from the individual fields for each product argument and the return value. This allows the elimination of product values except at function boundaries.
- The procedure is only a single iteration because the map of nodes ids and indices is a map from NodeIDs and a list of indices to the new NodeID (technically, it's a map from NodeIDs to a tree that contains NodeIDs at its leaves, where the tree structure defines the indices). This process also allows us to handle partial indexing into a product and ultimately the entire optimization eliminates partial indexing of products. This means that partial reads will actually be added to the map since a partial read can have remaining fields.
- Calls, returns, parameters, and constants are all handled ahead of time as they can be easily, but then the remaining node types require that we collect lists of nodes to add, replace uses of, and remove so that the IR remains valid as needed by the editor (specifically adding is done at the end since we need nodes to be added in the correct order and we have to wait for all nodes to be added before we can replace uses since otherwise we may try to replace uses with a NodeID that does not exist yet).
I do want to test this once we have interprocedural SROA to make sure everything cleans up the way it should, but we can merge this first or wait.
Resolves #8 (closed) now that !59 (merged) is merged.
Edited by Aaron Councilman