This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Speedup DOM and into-SSA
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 16 Nov 2004 10:50:28 -0500
- Subject: [PATCH] Speedup DOM and into-SSA
While looking why the testcase in PR 13776 was slow, I noticed that
at the top of the profile ggc_alloc was there. This usually means we
are
allocating too much in the GC space and I looked to figure out where
most of them were coming from. They were coming from varrays
block_defs_stack in tree-into-ssa.c. I decided to change it to VEC
which is allocated in the heap as we know the life time of the
stack. I noticed a 10 seconds speedup by doing this.
Before the patch:
tree SSA rewrite : 11.87 ( 8%) usr 0.49 ( 2%) sys 14.41 ( 7%)
wall
dominator optimization: 9.09 ( 6%) usr 0.80 ( 3%) sys 12.35 ( 6%)
wall
After:
tree SSA rewrite : 6.54 ( 5%) usr 0.41 ( 2%) sys 8.13 ( 4%)
wall
dominator optimization: 7.98 ( 6%) usr 0.80 ( 3%) sys 9.39 ( 5%)
wall
Both good improvements for an easy change.
OK? Bootstrapped and tested on powerpc-darwin with no regressions
Thanks,
Andrew Pinski
ChangeLog:
* tree-flow.h (tree2): Typedef because there is already a VEC(tree).
Define a VEC(tree2) for head.
(register_new_def): Change second argument to be a VEC(tree2).
* tree-ssa-dom.c (block_defs_stack): Change to be a VEC(tree2).
(tree_ssa_dominator_optimize): Initialize block_defs_stack with
the VEC(tree2) function. Also free it before returning.
(dom_opt_initialize_block): Use VEC_safe_push instead of
VARRAY_PUSH_TREE
for block_defs_stack.
(restore_currdefs_to_original_value): Use VEC_length instead of
VARRAY_ACTIVE_SIZE. VEC_pop instead of VARRAY_TOP_TREE/VARRAY_POP.
(dom_opt_finalize_block): Use VEC_safe_push instead of VARRAY_PUSH_TREE
for block_defs_stack.
* tree-into-ssa.c (block_defs_stack): Change to be a VEC(tree2).
(rewrite_initialize_block): Use VEC_safe_push instead of
VARRAY_PUSH_TREE
for block_defs_stack.
(ssa_register_new_def): Likewise.
(ssa_rewrite_initialize_block): Likewise.
(rewrite_finalize_block): Use VEC_length instead of
VARRAY_ACTIVE_SIZE. VEC_pop instead of VARRAY_TOP_TREE/VARRAY_POP.
(ssa_rewrite_finalize_block): Likewise.
(register_new_def): Change second argument to be a VEC(tree2).
Use VEC_safe_push instead of VARRAY_PUSH_TREE.
(rewrite_blocks): Initialize block_defs_stack with
the VEC(tree2) function. Also free it before returning.
(rewrite_ssa_into_ssa): Likewise.
Attachment:
temp1.diff.txt
Description: Text document