* [PATCH][4/n] Alias housekeeping
@ 2011-04-27 15:53 Richard Guenther
0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2011-04-27 15:53 UTC (permalink / raw)
To: gcc-patches
This moves PTA changed flag handling during solving from using
an sbitmap and an explicitly managed change_count to a bitmap.
Way easier to get right and also a requirement for pending work
that adds variables on-the-fly during solving (which would
require growing the sbitmap).
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
Will apply once that succeeded.
Richard.
2011-04-27 Richard Guenther <rguenther@suse.de>
* tree-ssa-structalias.c (changed_count): Remove.
(changed): Use a bitmap.
(unify_nodes): Adjust.
(do_sd_constraint): Likewise.
(do_ds_constraint): Likewise.
(do_complex_constraint): Likewise.
(solve_graph): Likewise.
Index: trunk/gcc/tree-ssa-structalias.c
===================================================================
*** trunk.orig/gcc/tree-ssa-structalias.c 2011-02-03 16:59:37.000000000 +0100
--- trunk/gcc/tree-ssa-structalias.c 2011-02-03 17:04:44.000000000 +0100
*************** build_succ_graph (void)
*** 1412,1419 ****
/* Changed variables on the last iteration. */
! static unsigned int changed_count;
! static sbitmap changed;
/* Strongly Connected Component visitation info. */
--- 1412,1418 ----
/* Changed variables on the last iteration. */
! static bitmap changed;
/* Strongly Connected Component visitation info. */
*************** unify_nodes (constraint_graph_t graph, u
*** 1544,1559 ****
/* Mark TO as changed if FROM was changed. If TO was already marked
as changed, decrease the changed count. */
! if (update_changed && TEST_BIT (changed, from))
{
! RESET_BIT (changed, from);
! if (!TEST_BIT (changed, to))
! SET_BIT (changed, to);
! else
! {
! gcc_assert (changed_count > 0);
! changed_count--;
! }
}
if (get_varinfo (from)->solution)
{
--- 1543,1553 ----
/* Mark TO as changed if FROM was changed. If TO was already marked
as changed, decrease the changed count. */
! if (update_changed
! && bitmap_bit_p (changed, from))
{
! bitmap_clear_bit (changed, from);
! bitmap_set_bit (changed, to);
}
if (get_varinfo (from)->solution)
{
*************** unify_nodes (constraint_graph_t graph, u
*** 1562,1572 ****
if (bitmap_ior_into (get_varinfo (to)->solution,
get_varinfo (from)->solution))
{
! if (update_changed && !TEST_BIT (changed, to))
! {
! SET_BIT (changed, to);
! changed_count++;
! }
}
BITMAP_FREE (get_varinfo (from)->solution);
--- 1556,1563 ----
if (bitmap_ior_into (get_varinfo (to)->solution,
get_varinfo (from)->solution))
{
! if (update_changed)
! bitmap_set_bit (changed, to);
}
BITMAP_FREE (get_varinfo (from)->solution);
*************** done:
*** 1727,1737 ****
if (flag)
{
get_varinfo (lhs)->solution = sol;
! if (!TEST_BIT (changed, lhs))
! {
! SET_BIT (changed, lhs);
! changed_count++;
! }
}
}
--- 1718,1724 ----
if (flag)
{
get_varinfo (lhs)->solution = sol;
! bitmap_set_bit (changed, lhs);
}
}
*************** do_ds_constraint (constraint_t c, bitmap
*** 1765,1777 ****
if (add_graph_edge (graph, t, rhs))
{
if (bitmap_ior_into (get_varinfo (t)->solution, sol))
! {
! if (!TEST_BIT (changed, t))
! {
! SET_BIT (changed, t);
! changed_count++;
! }
! }
}
return;
}
--- 1752,1758 ----
if (add_graph_edge (graph, t, rhs))
{
if (bitmap_ior_into (get_varinfo (t)->solution, sol))
! bitmap_set_bit (changed, t);
}
return;
}
*************** do_ds_constraint (constraint_t c, bitmap
*** 1811,1822 ****
{
t = find (escaped_id);
if (add_graph_edge (graph, t, rhs)
! && bitmap_ior_into (get_varinfo (t)->solution, sol)
! && !TEST_BIT (changed, t))
! {
! SET_BIT (changed, t);
! changed_count++;
! }
/* Enough to let rhs escape once. */
escaped_p = true;
}
--- 1792,1799 ----
{
t = find (escaped_id);
if (add_graph_edge (graph, t, rhs)
! && bitmap_ior_into (get_varinfo (t)->solution, sol))
! bitmap_set_bit (changed, t);
/* Enough to let rhs escape once. */
escaped_p = true;
}
*************** do_ds_constraint (constraint_t c, bitmap
*** 1826,1837 ****
t = find (v->id);
if (add_graph_edge (graph, t, rhs)
! && bitmap_ior_into (get_varinfo (t)->solution, sol)
! && !TEST_BIT (changed, t))
! {
! SET_BIT (changed, t);
! changed_count++;
! }
}
/* If the variable is not exactly at the requested offset
--- 1803,1810 ----
t = find (v->id);
if (add_graph_edge (graph, t, rhs)
! && bitmap_ior_into (get_varinfo (t)->solution, sol))
! bitmap_set_bit (changed, t);
}
/* If the variable is not exactly at the requested offset
*************** do_complex_constraint (constraint_graph_
*** 1879,1889 ****
if (flag)
{
get_varinfo (c->lhs.var)->solution = tmp;
! if (!TEST_BIT (changed, c->lhs.var))
! {
! SET_BIT (changed, c->lhs.var);
! changed_count++;
! }
}
}
}
--- 1852,1858 ----
if (flag)
{
get_varinfo (c->lhs.var)->solution = tmp;
! bitmap_set_bit (changed, c->lhs.var);
}
}
}
*************** solve_graph (constraint_graph_t graph)
*** 2578,2586 ****
unsigned int i;
bitmap pts;
! changed_count = 0;
! changed = sbitmap_alloc (size);
! sbitmap_zero (changed);
/* Mark all initial non-collapsed nodes as changed. */
for (i = 0; i < size; i++)
--- 2547,2553 ----
unsigned int i;
bitmap pts;
! changed = BITMAP_ALLOC (NULL);
/* Mark all initial non-collapsed nodes as changed. */
for (i = 0; i < size; i++)
*************** solve_graph (constraint_graph_t graph)
*** 2589,2604 ****
if (find (i) == i && !bitmap_empty_p (ivi->solution)
&& ((graph->succs[i] && !bitmap_empty_p (graph->succs[i]))
|| VEC_length (constraint_t, graph->complex[i]) > 0))
! {
! SET_BIT (changed, i);
! changed_count++;
! }
}
/* Allocate a bitmap to be used to store the changed bits. */
pts = BITMAP_ALLOC (&pta_obstack);
! while (changed_count > 0)
{
unsigned int i;
struct topo_info *ti = init_topo_info ();
--- 2556,2568 ----
if (find (i) == i && !bitmap_empty_p (ivi->solution)
&& ((graph->succs[i] && !bitmap_empty_p (graph->succs[i]))
|| VEC_length (constraint_t, graph->complex[i]) > 0))
! bitmap_set_bit (changed, i);
}
/* Allocate a bitmap to be used to store the changed bits. */
pts = BITMAP_ALLOC (&pta_obstack);
! while (!bitmap_empty_p (changed))
{
unsigned int i;
struct topo_info *ti = init_topo_info ();
*************** solve_graph (constraint_graph_t graph)
*** 2624,2630 ****
/* If the node has changed, we need to process the
complex constraints and outgoing edges again. */
! if (TEST_BIT (changed, i))
{
unsigned int j;
constraint_t c;
--- 2588,2594 ----
/* If the node has changed, we need to process the
complex constraints and outgoing edges again. */
! if (bitmap_clear_bit (changed, i))
{
unsigned int j;
constraint_t c;
*************** solve_graph (constraint_graph_t graph)
*** 2632,2640 ****
VEC(constraint_t,heap) *complex = graph->complex[i];
bool solution_empty;
- RESET_BIT (changed, i);
- changed_count--;
-
/* Compute the changed set of solution bits. */
bitmap_and_compl (pts, get_varinfo (i)->solution,
get_varinfo (i)->oldsolution);
--- 2596,2601 ----
*************** solve_graph (constraint_graph_t graph)
*** 2697,2707 ****
if (flag)
{
get_varinfo (to)->solution = tmp;
! if (!TEST_BIT (changed, to))
! {
! SET_BIT (changed, to);
! changed_count++;
! }
}
}
}
--- 2658,2664 ----
if (flag)
{
get_varinfo (to)->solution = tmp;
! bitmap_set_bit (changed, to);
}
}
}
*************** solve_graph (constraint_graph_t graph)
*** 2712,2718 ****
}
BITMAP_FREE (pts);
! sbitmap_free (changed);
bitmap_obstack_release (&oldpta_obstack);
}
--- 2669,2675 ----
}
BITMAP_FREE (pts);
! BITMAP_FREE (changed);
bitmap_obstack_release (&oldpta_obstack);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-27 15:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-27 15:53 [PATCH][4/n] Alias housekeeping Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).