Hi, As discussed at thread "http://gcc.gnu.org/ml/gcc/2012-04/msg00396.html", I am trying a patch now. The problem here is I have to go through all basic block from "sink_from" to "sink_to" to check whether the memory might be clobbered in them. Currently I have two methods: 1, do fully data analysis to compute the "can_sink" information at each basic block, which means whether we can sink a load to a basic block; 2, just compute the transitive closure of CFG, and check any basic block dominated by "sink_from" and can reach "sink_to" basic block;
The 2nd method is an approximation, simpler than method 1 but misses some cases like: L1: load x L2: using x L3: set x goto L1 In which, "load x" should be sunk to L2 if there is benefit. I measured the number of sunk loads during bootstrap gcc for x86, there are about 732 using method 1, while only 602 using method 2. So any comment on this topic? Thanks very much. -- Best Regards.