------- Additional Comments From steven at gcc dot gnu dot org 2005-02-07
23:13 -------
Using var_to_partition does not help. The reason is that the SSA names with
the same root var are not in the same partition, e.g.
int
foo (int x, int a, int b)
{
x = a + b;
x = x * a;
x = x * b;
return x;
}
-->
Sorted Coalesce list:
Partition map
Partition 0 (x_3 - 3 )
Partition 1 (x_4 - 4 )
Partition 2 (x_5 - 5 )
After Coalescing:
Partition map
Partition 0 (a_1 - 1 )
Partition 1 (b_2 - 2 )
Partition 2 (x_3 - 3 )
Partition 3 (x_4 - 4 )
Partition 4 (x_5 - 5 )
Partition 5 (<retval>_7 - 7 )
Replacing Expressions
x_3 replace with --> a_1 + b_2
x_4 replace with --> a_1 * x_3
x_5 replace with --> b_2 * x_4
<retval>_7 --> <retval>
x_3 --> x
x_4 not coalesced with x --> New temp: 'x.0'
x_5 not coalesced with x.0 --> New temp: 'x.1'
b_2 --> b
a_1 --> a
After Root variable replacement:
Partition map
Partition 0 (a - 1 )
Partition 1 (b - 2 )
Partition 2 (x - 3 )
Partition 3 (x.0 - 4 )
Partition 4 (x.1 - 5 )
Partition 5 (<retval> - 7 )
So if you replace the root var comparison in my hack with a check to make sure
def and def2 are not in the same partition, that whole check will always be
false and you still get crap code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17549