public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-82] Split out solve_add_graph_edge
@ 2023-04-19 13:43 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-04-19 13:43 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2cef0d0964d74dd61d3f4df855d521a0ff219a03
commit r14-82-g2cef0d0964d74dd61d3f4df855d521a0ff219a03
Author: Richard Biener <rguenther@suse.de>
Date: Tue Mar 14 14:38:01 2023 +0100
Split out solve_add_graph_edge
Split out a worker with all the special-casings when adding a graph
edge during solving.
* tree-ssa-structalias.cc (solve_add_graph_edge): New function,
split out from ...
(do_sd_constraint): ... here.
Diff:
---
gcc/tree-ssa-structalias.cc | 35 ++++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc
index 39c342fae41..84c625d53e5 100644
--- a/gcc/tree-ssa-structalias.cc
+++ b/gcc/tree-ssa-structalias.cc
@@ -1640,6 +1640,29 @@ topo_visit (constraint_graph_t graph, struct topo_info *ti,
ti->topo_order.safe_push (n);
}
+/* Add a copy edge FROM -> TO, optimizing special cases. Returns TRUE
+ if the solution of TO changed. */
+
+static bool
+solve_add_graph_edge (constraint_graph_t graph, unsigned int to,
+ unsigned int from)
+{
+ /* Adding edges from the special vars is pointless.
+ They don't have sets that can change. */
+ if (get_varinfo (from)->is_special_var)
+ return bitmap_ior_into (get_varinfo (to)->solution,
+ get_varinfo (from)->solution);
+ /* Merging the solution from ESCAPED needlessly increases
+ the set. Use ESCAPED as representative instead. */
+ else if (from == find (escaped_id))
+ return bitmap_set_bit (get_varinfo (to)->solution, escaped_id);
+ else if (get_varinfo (from)->may_have_pointers
+ && add_graph_edge (graph, to, from))
+ return bitmap_ior_into (get_varinfo (to)->solution,
+ get_varinfo (from)->solution);
+ return false;
+}
+
/* Process a constraint C that represents x = *(y + off), using DELTA as the
starting solution for y. */
@@ -1700,17 +1723,7 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c,
{
t = find (v->id);
- /* Adding edges from the special vars is pointless.
- They don't have sets that can change. */
- if (get_varinfo (t)->is_special_var)
- flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
- /* Merging the solution from ESCAPED needlessly increases
- the set. Use ESCAPED as representative instead. */
- else if (t == find (escaped_id))
- flag |= bitmap_set_bit (sol, escaped_id);
- else if (v->may_have_pointers
- && add_graph_edge (graph, lhs, t))
- flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
+ flag |= solve_add_graph_edge (graph, lhs, t);
if (v->is_full_var
|| v->next == 0)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-19 13:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 13:43 [gcc r14-82] Split out solve_add_graph_edge Richard Biener
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).