[PATCH]: Correct iteration order of calculate_reg_pav

Daniel Berlin dberlin@dberlin.org
Wed Sep 14 23:18:00 GMT 2005


The docs and comments claim it wants to iterate in reverse post order
numbers, however, it *actually* iterates in regular post order order.
That is what flow_reverse_topsort_order_compute computes.

I've taken it at face value that RPO is really the ordering you want.

The RPO numbers can be computed by flow_depth_first_order_compute.

I verified this by hand by writing the natural recursive postorder
traversal

bbs = result for flow_reverse_topsort_order_compute
bbs2 = result for regular postorder traversal

(gdb) p bbs[0]@17
$14 = {16, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15, 0}
(gdb) p bbs2[0]@17
$14 = {16, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15, 0}


Then, we look at the output of flow_depth_first_order_compute's
rc_array, and we get:

(gdb) p bbs[0]@17
$15 = {0, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16}

IE reverse post order

Thus, i changed everything to use what it claims it wants to use, which
seems right since it is a forward dataflow problem.

Bootstrapped and regtested on i686-pc-linux-gnu.
Okay for mainline?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rpo.diff
Type: text/x-patch
Size: 2599 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050914/b5f4d1b3/attachment.bin>


More information about the Gcc-patches mailing list