Compute RPO with adjacent SCC members, expose toplevel SCC extents
This produces a more optimal RPO order for iteration processing
by making sure that SCC exits are processed before SCC members
themselves.. This avoids iterating blocks unrelated to the current
iteration for RPO VN and has the chance to improve code-generation
for the non-iterative mode of RPO VN. The patch also exposes toplevel
SCCs and gets rid of the ad-hoc max_rpo computation in RPO VN.
For simplicity it also removes the odd reverse ordering of the RPO
array returned from rev_post_order_and_mark_dfs_back_seme.
Overall reduction in the number of visited blocks isn't spectacular
for bootstrap (~2.5%) but single cases see up to a 10% reduction.
The same function can be used to optimize var-tracking iteration order
as seen in the followup.
2020-07-28 Richard Biener <rguenther@suse.de>
* cfganal.h (rev_post_order_and_mark_dfs_back_seme): Adjust
prototype.
* cfganal.c (rpoamdbs_bb_data): New struct with pre BB data.
(tag_header): New helper.
(cmp_edge_dest_pre): Likewise.
(rev_post_order_and_mark_dfs_back_seme): Compute SCCs,
find SCC exits and perform a DFS walk with extra edges to
compute a RPO with adjacent SCC members when requesting an
iteration optimized order and populate the toplevel SCC array.
* tree-ssa-sccvn.c (do_rpo_vn): Remove ad-hoc computation
of max_rpo and fill it in from SCC extent info instead.
* gcc.dg/torture/
20200727-0.c: New testcase.