On 09/19/2012 01:00 PM, Aurelien Jarno wrote: > The copy propagation pass tries to keep track of what is a copy of what > and what has copy of what, and in addition it keep a circular list of > of all the copies. Unfortunately this doesn't fully work: a mov from > a temp which has a state "COPY" changes it into a state "HAS_COPY". > Later when this temp is used again, it is considered has not having > copy and thus no propagation is done. > > This patch fixes that by removing the hiearchy between copies, and thus > only keeping a "COPY" state both meaning "is a copy" and "has a copy". > The decision of which copy to use is deferred to the actual temp > replacement. At this stage there is not one best choice to do, but only > better choices than others. For doing the best choice the operation > would have to be parsed in reversed to know if a temp is going to be > used later or not. That what is done by the liveness analysis. At this > stage it is known that globals will always be live, that local temps > will be dead at the end of the translation block, and that the temps > will be dead at the end of the basic block. This means that this stage > should try to replace temps by local temps or globals and local temps > by globals. > > It also brings the advantage of knowing if a temp is a copy of another, > which can improve the various optimizations. > > Signed-off-by: Aurelien Jarno <aurel...@aurel32.net>
Reviewed-by: Richard Henderson <r...@twiddle.net> r~