From 55b15e30ecdf81b8c640da376469a9f92e8d1eb7 Mon Sep 17 00:00:00 2001 From: davidxl Date: Wed, 4 Dec 2013 19:46:36 +0000 Subject: [PATCH] Update changed bit when constraint set changes git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205677 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/tree-ssa-structalias.c | 29 +++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4a1e0a6d2f..320f186477f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-12-03 Xinliang David Li + + * tree-ssa-structalias.c (constraint_set_union): Change return type + from void to bool. + (merge_node_constraints): Ditto. + (unify_nodes): Update changed set when constraints set changes. + 2013-12-04 H.J. Lu * configure.ac: Append gdbasan.in to .gdbinit if CFLAGS contains diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 6482e68c04f..16679f41ce9 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -892,14 +892,16 @@ constraint_vec_find (vec vec, return found; } -/* Union two constraint vectors, TO and FROM. Put the result in TO. */ +/* Union two constraint vectors, TO and FROM. Put the result in TO. + Returns true of TO set is changed. */ -static void +static bool constraint_set_union (vec *to, vec *from) { int i; constraint_t c; + bool any_change = false; FOR_EACH_VEC_ELT (*from, i, c) { @@ -907,8 +909,10 @@ constraint_set_union (vec *to, { unsigned int place = to->lower_bound (c, constraint_less); to->safe_insert (place, c); + any_change = true; } } + return any_change; } /* Expands the solution in SET to all sub-fields of variables included. */ @@ -1028,22 +1032,24 @@ insert_into_complex (constraint_graph_t graph, /* Condense two variable nodes into a single variable node, by moving - all associated info from SRC to TO. */ + all associated info from FROM to TO. Returns true if TO node's + constraint set changes after the merge. */ -static void +static bool merge_node_constraints (constraint_graph_t graph, unsigned int to, unsigned int from) { unsigned int i; constraint_t c; + bool any_change = false; gcc_checking_assert (find (from) == to); /* Move all complex constraints from src node into to node */ FOR_EACH_VEC_ELT (graph->complex[from], i, c) { - /* In complex constraints for node src, we may have either - a = *src, and *src = a, or an offseted constraint which are + /* In complex constraints for node FROM, we may have either + a = *FROM, and *FROM = a, or an offseted constraint which are always added to the rhs node's constraints. */ if (c->rhs.type == DEREF) @@ -1052,9 +1058,12 @@ merge_node_constraints (constraint_graph_t graph, unsigned int to, c->lhs.var = to; else c->rhs.var = to; + } - constraint_set_union (&graph->complex[to], &graph->complex[from]); + any_change = constraint_set_union (&graph->complex[to], + &graph->complex[from]); graph->complex[from].release (); + return any_change; } @@ -1472,7 +1481,11 @@ unify_nodes (constraint_graph_t graph, unsigned int to, unsigned int from, stats.unified_vars_static++; merge_graph_nodes (graph, to, from); - merge_node_constraints (graph, to, from); + if (merge_node_constraints (graph, to, from)) + { + if (update_changed) + bitmap_set_bit (changed, to); + } /* Mark TO as changed if FROM was changed. If TO was already marked as changed, decrease the changed count. */ -- 2.11.4.GIT