Hi, Currently GCC does hard register forward propagation in pass_cprop_hardreg to remove as many dependencies as possible and delete redundant copies, but this pass is limited in each basic block so cannot do any global propagation. While as a fact, GCC does generate redundant copies/loads crossing basic block after reload pass, as reported by http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52412 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44025
I understand that maybe these should be fixed before cprop_hardreg pass, it is also valuable to have cprop_hardreg extened into global pass, thus it can act like a gate keeper to remedy the problem as our last chance. I have already worked out an initial patch to extend the pass in two ways: 1. extend it into a global pass; 2. make it handle const propagation; In fact, the code change can be very small by reusing facilities in cprop.c as described below: 1. compute cprop_avin/cprop_avout by calling function like compute_cprop_data in cprop.c. 2. use cprop_avin[bb] to initialize the global propagation information for each basic block. 3. do propagation as usual by calling copyprop_hardreg_forward_1. 4. make cprop_hardreg do const propagation with some other trivial modifications. So is this kind extension wanted in GCC, especially considering the simplicity and gains? Thanks, and any suggestion will be highly appreciated. -- Best Regards.