summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-29 14:22:47 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-29 14:22:47 +0000
commit783d1e8983db5705d0a3b7aca9586de402b94851 (patch)
tree53ed24d2dc1f4973861b51fd4a6e3c8de75d095c /gcc/tree-ssa-structalias.c
parent1b1b3800fb0a3fbeb12511f2f7c85c9a36dbd74f (diff)
downloadgcc-783d1e8983db5705d0a3b7aca9586de402b94851.tar.gz
2013-01-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/56113 * tree-ssa-structalias.c (equiv_class_lookup): Also return the bitmap leader. (label_visit): Free duplicate bitmaps and record the leader instead. (perform_var_substitution): Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195541 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 4ad956f6649..cacfdab3732 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -1907,10 +1907,10 @@ equiv_class_label_eq (const void *p1, const void *p2)
}
/* Lookup a equivalence class in TABLE by the bitmap of LABELS it
- contains. */
+ contains. Sets *REF_LABELS to the bitmap LABELS is equivalent to. */
static unsigned int
-equiv_class_lookup (htab_t table, bitmap labels)
+equiv_class_lookup (htab_t table, bitmap labels, bitmap *ref_labels)
{
void **slot;
struct equiv_class_label ecl;
@@ -1921,9 +1921,18 @@ equiv_class_lookup (htab_t table, bitmap labels)
slot = htab_find_slot_with_hash (table, &ecl,
ecl.hashcode, NO_INSERT);
if (!slot)
- return 0;
+ {
+ if (ref_labels)
+ *ref_labels = NULL;
+ return 0;
+ }
else
- return ((equiv_class_label_t) *slot)->equivalence_class;
+ {
+ equiv_class_label_t ec = (equiv_class_label_t) *slot;
+ if (ref_labels)
+ *ref_labels = ec->labels;
+ return ec->equivalence_class;
+ }
}
@@ -2123,14 +2132,21 @@ label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n)
if (!bitmap_empty_p (graph->points_to[n]))
{
+ bitmap ref_points_to;
unsigned int label = equiv_class_lookup (pointer_equiv_class_table,
- graph->points_to[n]);
+ graph->points_to[n],
+ &ref_points_to);
if (!label)
{
label = pointer_equiv_class++;
equiv_class_add (pointer_equiv_class_table,
label, graph->points_to[n]);
}
+ else
+ {
+ BITMAP_FREE (graph->points_to[n]);
+ graph->points_to[n] = ref_points_to;
+ }
graph->pointer_label[n] = label;
}
}
@@ -2190,7 +2206,7 @@ perform_var_substitution (constraint_graph_t graph)
/* Look up the location equivalence label if one exists, or make
one otherwise. */
label = equiv_class_lookup (location_equiv_class_table,
- pointed_by);
+ pointed_by, NULL);
if (label == 0)
{
label = location_equiv_class++;