This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Another aliasing speedup
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 Feb 2003 16:53:41 -0700
- Subject: [tree-ssa] Another aliasing speedup
- Reply-to: law at redhat dot com
While investigating elimination of the double-simplification of trees,
I stumbled on the solution for a compile-time performance issue I tabled
in the aliasing code.
Specifically we're walking an excessive number of nodes when searching
for variables. If you debug find_vars_r and its calls from walk_tree
you'd see that we walk into the children of type nodes, children of
_DECL nodes and such. None of those walks are useful.
This patch stops the walker from descending into children unnecessarily
by clearing walk_subtrees. It cuts another 35-40% off the alias analysis
time. In real terms it's about 1.5 seconds of my components of cc1 test.
Anyway, now that's done and I'll return to trying to avoid double-
gimplification of our trees.
* tree-dfa.c (find_vars_r): Clear *walk_subtrees appropriately
to avoid useless walking of subtrees.
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.82
diff -c -3 -p -r1.1.4.82 tree-dfa.c
*** tree-dfa.c 26 Feb 2003 16:26:03 -0000 1.1.4.82
--- tree-dfa.c 27 Feb 2003 22:48:59 -0000
*************** find_vars_r (tp, walk_subtrees, data)
*** 2103,2108 ****
--- 2103,2126 ----
struct walk_state *walk_state = (struct walk_state *)data;
int saved_is_store = walk_state->is_store;
+ /* Type and constant nodes have no interesting children. Ignore them. */
+ if (TYPE_P (t) || TREE_CODE_CLASS (TREE_CODE (t)) == 'c')
+ {
+ *walk_subtrees = 0;
+ return NULL_TREE;
+ }
+
+ /* DECL nodes have no interesting children. */
+ if (DECL_P (t))
+ {
+ *walk_subtrees = 0;
+
+ /* If this _DECL node is not interesting to the SSA builder,
+ then we can just return now. */
+ if (! SSA_VAR_P (t))
+ return NULL_TREE;
+ }
+
if (TREE_CODE (t) == MODIFY_EXPR || TREE_CODE (t) == INIT_EXPR)
{
walk_state->is_store = 1;