Commit aa46c8a3 by Daniel Berlin Committed by Daniel Berlin

tree-ssa-structalias.c (rewrite_constraints): Don't test for directness anymore.

2007-10-17  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa-structalias.c (rewrite_constraints): Don't test for
	directness anymore.
	(perform_var_substitution): Only DFS from real nodes. Don't test
	for directness.
	(unite_pointer_equivalences): Fix broken test.

From-SVN: r129401
parent 45b194f8
2007-10-17 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-structalias.c (rewrite_constraints): Don't test for
directness anymore.
(perform_var_substitution): Only DFS from real nodes. Don't test
for directness.
(unite_pointer_equivalences): Fix broken test.
2007-10-17 Alan Modra <amodra@bigpond.net.au> 2007-10-17 Alan Modra <amodra@bigpond.net.au>
* config/rs6000/rs6000.c (rs6000_emit_epilogue): Correct * config/rs6000/rs6000.c (rs6000_emit_epilogue): Correct
...@@ -461,8 +461,10 @@ struct constraint_graph ...@@ -461,8 +461,10 @@ struct constraint_graph
variable substitution. */ variable substitution. */
int *eq_rep; int *eq_rep;
/* Pointer equivalence node for a node. if pe[a] != a, then node a /* Pointer equivalence label for a node. All nodes with the same
can be united with node pe[a] after initial constraint building. */ pointer equivalence label can be unified together at some point
(either during constraint optimization or after the constraint
graph is built). */
unsigned int *pe; unsigned int *pe;
/* Pointer equivalence representative for a label. This is used to /* Pointer equivalence representative for a label. This is used to
...@@ -969,13 +971,12 @@ init_graph (unsigned int size) ...@@ -969,13 +971,12 @@ init_graph (unsigned int size)
graph->indirect_cycles = XNEWVEC (int, graph->size); graph->indirect_cycles = XNEWVEC (int, graph->size);
graph->rep = XNEWVEC (unsigned int, graph->size); graph->rep = XNEWVEC (unsigned int, graph->size);
graph->complex = XCNEWVEC (VEC(constraint_t, heap) *, size); graph->complex = XCNEWVEC (VEC(constraint_t, heap) *, size);
graph->pe = XNEWVEC (unsigned int, graph->size); graph->pe = XCNEWVEC (unsigned int, graph->size);
graph->pe_rep = XNEWVEC (int, graph->size); graph->pe_rep = XNEWVEC (int, graph->size);
for (j = 0; j < graph->size; j++) for (j = 0; j < graph->size; j++)
{ {
graph->rep[j] = j; graph->rep[j] = j;
graph->pe[j] = j;
graph->pe_rep[j] = -1; graph->pe_rep[j] = -1;
graph->indirect_cycles[j] = -1; graph->indirect_cycles[j] = -1;
} }
...@@ -1276,7 +1277,8 @@ unify_nodes (constraint_graph_t graph, unsigned int to, unsigned int from, ...@@ -1276,7 +1277,8 @@ unify_nodes (constraint_graph_t graph, unsigned int to, unsigned int from,
changed_count--; changed_count--;
} }
} }
if (get_varinfo (from)->solution)
{
/* If the solution changes because of the merging, we need to mark /* If the solution changes because of the merging, we need to mark
the variable as changed. */ the variable as changed. */
if (bitmap_ior_into (get_varinfo (to)->solution, if (bitmap_ior_into (get_varinfo (to)->solution,
...@@ -1297,7 +1299,7 @@ unify_nodes (constraint_graph_t graph, unsigned int to, unsigned int from, ...@@ -1297,7 +1299,7 @@ unify_nodes (constraint_graph_t graph, unsigned int to, unsigned int from,
BITMAP_FREE (get_varinfo (to)->oldsolution); BITMAP_FREE (get_varinfo (to)->oldsolution);
get_varinfo (to)->oldsolution = BITMAP_ALLOC (&oldpta_obstack); get_varinfo (to)->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
} }
}
if (valid_graph_edge (graph, to, to)) if (valid_graph_edge (graph, to, to))
{ {
if (graph->succs[to]) if (graph->succs[to])
...@@ -1942,13 +1944,13 @@ perform_var_substitution (constraint_graph_t graph) ...@@ -1942,13 +1944,13 @@ perform_var_substitution (constraint_graph_t graph)
/* Condense the nodes, which means to find SCC's, count incoming /* Condense the nodes, which means to find SCC's, count incoming
predecessors, and unite nodes in SCC's. */ predecessors, and unite nodes in SCC's. */
for (i = 0; i < LAST_REF_NODE; i++) for (i = 0; i < FIRST_REF_NODE; i++)
if (!TEST_BIT (si->visited, si->node_mapping[i])) if (!TEST_BIT (si->visited, si->node_mapping[i]))
condense_visit (graph, si, si->node_mapping[i]); condense_visit (graph, si, si->node_mapping[i]);
sbitmap_zero (si->visited); sbitmap_zero (si->visited);
/* Actually the label the nodes for pointer equivalences */ /* Actually the label the nodes for pointer equivalences */
for (i = 0; i < LAST_REF_NODE; i++) for (i = 0; i < FIRST_REF_NODE; i++)
if (!TEST_BIT (si->visited, si->node_mapping[i])) if (!TEST_BIT (si->visited, si->node_mapping[i]))
label_visit (graph, si, si->node_mapping[i]); label_visit (graph, si, si->node_mapping[i]);
...@@ -2014,8 +2016,7 @@ perform_var_substitution (constraint_graph_t graph) ...@@ -2014,8 +2016,7 @@ perform_var_substitution (constraint_graph_t graph)
{ {
unsigned int node = si->node_mapping[i]; unsigned int node = si->node_mapping[i];
if (graph->pointer_label[node] == 0 if (graph->pointer_label[node] == 0)
&& TEST_BIT (graph->direct_nodes, node))
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, fprintf (dump_file,
...@@ -2100,14 +2101,21 @@ unite_pointer_equivalences (constraint_graph_t graph) ...@@ -2100,14 +2101,21 @@ unite_pointer_equivalences (constraint_graph_t graph)
/* Go through the pointer equivalences and unite them to their /* Go through the pointer equivalences and unite them to their
representative, if they aren't already. */ representative, if they aren't already. */
for (i = 0; i < graph->size; i++) for (i = 0; i < FIRST_REF_NODE; i++)
{ {
unsigned int label = graph->pe[i]; unsigned int label = graph->pe[i];
if (label)
{
int label_rep = graph->pe_rep[label]; int label_rep = graph->pe_rep[label];
if (label != i && unite (label_rep, i)) if (label_rep == -1)
continue;
label_rep = find (label_rep);
if (label_rep >= 0 && unite (label_rep, find (i)))
unify_nodes (graph, label_rep, i, false); unify_nodes (graph, label_rep, i, false);
} }
}
} }
/* Move complex constraints to the GRAPH nodes they belong to. */ /* Move complex constraints to the GRAPH nodes they belong to. */
...@@ -2177,10 +2185,6 @@ rewrite_constraints (constraint_graph_t graph, ...@@ -2177,10 +2185,6 @@ rewrite_constraints (constraint_graph_t graph,
the constraint. */ the constraint. */
if (lhslabel == 0) if (lhslabel == 0)
{ {
if (!TEST_BIT (graph->direct_nodes, lhsnode))
lhslabel = graph->pointer_label[lhsnode] = pointer_equiv_class++;
else
{
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
...@@ -2192,14 +2196,9 @@ rewrite_constraints (constraint_graph_t graph, ...@@ -2192,14 +2196,9 @@ rewrite_constraints (constraint_graph_t graph,
VEC_replace (constraint_t, constraints, i, NULL); VEC_replace (constraint_t, constraints, i, NULL);
continue; continue;
} }
}
if (rhslabel == 0) if (rhslabel == 0)
{ {
if (!TEST_BIT (graph->direct_nodes, rhsnode))
rhslabel = graph->pointer_label[rhsnode] = pointer_equiv_class++;
else
{
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
...@@ -2211,7 +2210,6 @@ rewrite_constraints (constraint_graph_t graph, ...@@ -2211,7 +2210,6 @@ rewrite_constraints (constraint_graph_t graph,
VEC_replace (constraint_t, constraints, i, NULL); VEC_replace (constraint_t, constraints, i, NULL);
continue; continue;
} }
}
lhsvar = find_equivalent_node (graph, lhsvar, lhslabel); lhsvar = find_equivalent_node (graph, lhsvar, lhslabel);
rhsvar = find_equivalent_node (graph, rhsvar, rhslabel); rhsvar = find_equivalent_node (graph, rhsvar, rhslabel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment