diff options
author | Richard Biener <rguenther@suse.de> | 2013-02-01 12:38:45 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-02-01 12:38:45 +0000 |
commit | 8c7ca45c9d2641477ceebf30568af8d4c49ff2f9 (patch) | |
tree | 8f672cc7249c99122a89095a42c155ec4d1655fa /gcc/tree-ssa-structalias.c | |
parent | 9f419393f2a0219c6f2e7ad083e61b370ca36827 (diff) | |
download | gcc-8c7ca45c9d2641477ceebf30568af8d4c49ff2f9.zip gcc-8c7ca45c9d2641477ceebf30568af8d4c49ff2f9.tar.gz gcc-8c7ca45c9d2641477ceebf30568af8d4c49ff2f9.tar.bz2 |
re PR c/56113 (out of memory when compiling a function with many goto labels (50k > ))
2013-02-01 Richard Biener <rguenther@suse.de>
PR tree-optimization/56113
* tree-ssa-structalias.c (label_visit): Reduce work for
single-predecessor nodes.
From-SVN: r195646
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 1bbe1cc..bee27b1 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -2107,14 +2107,13 @@ condense_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n) static void label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n) { - unsigned int i; + unsigned int i, first_pred; bitmap_iterator bi; - bitmap_set_bit (si->visited, n); - if (!graph->points_to[n]) - graph->points_to[n] = BITMAP_ALLOC (&predbitmap_obstack); + bitmap_set_bit (si->visited, n); /* Label and union our incoming edges's points to sets. */ + first_pred = -1U; EXECUTE_IF_IN_NONNULL_BITMAP (graph->preds[n], 0, i, bi) { unsigned int w = si->node_mapping[i]; @@ -2126,11 +2125,45 @@ label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n) continue; if (graph->points_to[w]) - bitmap_ior_into(graph->points_to[n], graph->points_to[w]); + { + if (first_pred == -1U) + first_pred = w; + else if (!graph->points_to[n]) + { + graph->points_to[n] = BITMAP_ALLOC (&predbitmap_obstack); + bitmap_ior (graph->points_to[n], + graph->points_to[first_pred], graph->points_to[w]); + } + else + bitmap_ior_into(graph->points_to[n], graph->points_to[w]); + } } - /* Indirect nodes get fresh variables. */ + + /* Indirect nodes get fresh variables and a new pointer equiv class. */ if (!bitmap_bit_p (graph->direct_nodes, n)) - bitmap_set_bit (graph->points_to[n], FIRST_REF_NODE + n); + { + if (!graph->points_to[n]) + { + graph->points_to[n] = BITMAP_ALLOC (&predbitmap_obstack); + if (first_pred != -1U) + bitmap_copy (graph->points_to[n], graph->points_to[first_pred]); + } + bitmap_set_bit (graph->points_to[n], FIRST_REF_NODE + n); + graph->pointer_label[n] = pointer_equiv_class++; + return; + } + + /* If there was only a single non-empty predecessor the pointer equiv + class is the same. */ + if (!graph->points_to[n]) + { + if (first_pred != -1U) + { + graph->pointer_label[n] = graph->pointer_label[first_pred]; + graph->points_to[n] = graph->points_to[first_pred]; + } + return; + } if (!bitmap_empty_p (graph->points_to[n])) { |