http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51964
--- Comment #1 from vries at gcc dot gnu.org 2012-01-23 13:43:33 UTC --- I have a still rather vague idea that we might value number the uses rather than the defs: assign the same number to uses which use a value in the same way. I don't know how that would work exactly, but the idea is something like this: ... syntax: a -> b : a is used to copy to b a -> <b,c,d>: a is used as b to define c and d. # .MEMD.1719_7 = PHI <.MEMD.1719_10(5), .MEMD.1719_11(6)> .MEMD.1719_10(5) -> .MEMD.1719_7 .MEMD.1719_11(6) -> .MEMD.1719_7 # aD.1712_1 = PHI <aD.1712_4(5), aD.1712_5(6)> aD.1712_4(5) -> aD.1712_1 aD.1712_5(6) -> aD.1712_1 # .MEMD.1719_10 = VDEF <.MEMD.1719_6> # USE = nonlocal # CLB = nonlocal aD.1712_4 = barD.1703 (7); bar -> <call, .MEMD.1719_7, aD.1712_1> .MEMD.1719_6 -> <vuse, .MEMD.1719_7, aD.1712_1> 7 -> <callarg0, .MEMD.1719_7, aD.1712_1> # .MEMD.1719_11 = VDEF <.MEMD.1719_8(D)> # USE = nonlocal # CLB = nonlocal aD.1712_5 = barD.1703 (7); bar -> <call, .MEMD.1719_7, aD.1712_1> .MEMD.1719_8(D) -> <vuse, .MEMD.1719_7, aD.1712_1> 7 -> <callarg0, .MEMD.1719_7, aD.1712_1> ... By comparing the value numbers of the uses of the 2 calls, we can conclude that the calls use values in the same way, which means we can merge them. And in order to merge them we need to insert phis to merge the actual values that are used. In the example above, we would only need a phi for .MEMD.1719_6 and .MEMD.1719_8(D). And if we had f.i. 'bar (7)' and 'bar (8)' in the example, this still would compare equal, and we would have to insert a phi (7,8) and use that as argument of the tail-merged call to bar.