Closed
Description
It might be better to generate phis instead of emitting allocas and letting LLVM do the work in the (I think) SRoA optimization pass.
An example of what could be done (in C, without the case of taking the address of the local) is at https://gist.github.com/o11c/7995342
The general approach is:
For each block, create a phi node for each live variable.
For each jump to a block, add an alternative on the phi with the value before that jump.
Unlike C++, Rust can afford to do this in the general case because moves are always free. However, it is still complicated by the fact that there may be references to the variable.
Metadata
Metadata
Assignees
Labels
No labels