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
A set of virtual registers that are defined only once and loaded from same method input parameter on the stack and that input parameter is never updated, can be folded into a single load.
Plan: Insert load parameter instruction into the first block that dominates all other blocks which use the parameter. The load will move the parameter to a virtual instruction. The load instruction is placed at the end of the block, or if the block contains any existing load instruction, then immediately prior to that instruction. Replace all other load instructions with a move from the virtual instruction.
Alternative longer-term option: Similar to before, but instead move all the load instructions to the beginning of the first block. And write another optimization stage that re-orders instructions to reduce the distance between assignments (results) and uses. The register allocator will then "best-fit" the live ranges.
A set of virtual registers that are defined only once and loaded from same method input parameter on the stack and that input parameter is never updated, can be folded into a single load.
Example:
In System.String::IndexOfAny(System.Char[])
In this example, the this variable should only be loaded at once into a single virtual register.
The initial load must be placed before all uses from all paths.
A native implementation can place the load in the first block during an early IR stage. This could be helpful for some SSA optimizations.
Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: