This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Speed up into-ssa pass
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 13 May 2004 16:44:43 -0600
- Subject: Speed up into-ssa pass
- Reply-to: law at redhat dot com
This patch contains two minor speedups to the into-ssa pass.
First, the set of blocks where a given variable is locally live-in is
typically sparse. We were did a linear walk through the blocks to
initialize our worklist even though we had a bitmap for the livein
blocks.
So clearly the right thing is to change the FOR_EACH_BB into an
EXECUTE_IF_SET_IN_BITMAP which is vastly more efficient for sparse
data.
The second bit of lameness is something Zdenek pointed out, specifically
it's silly to be testing the "kills" bitmap for virtual variables in
mark_def_sites -- the test is always true and thus we're just wasting
time.
Bootstrapped and regression tested on i686-pc-linux-gnu.
* tree-into-ssa.c (compute_global_livein): Use EXECUTE_IF_SET_IN_BITMAP
rather than iterating through the blocks testing each bit in
livein to initialize the worklist.
(mark_def_sites): Remove useless checks of KILLS for virtual
operands.
Index: tree-into-ssa.c
===================================================================
RCS file: /export/cvsroot/gcc/gcc/tree-into-ssa.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** tree-into-ssa.c 6 May 2004 17:34:35 -0000 1.1
--- tree-into-ssa.c 6 May 2004 18:53:44 -0000 1.2
***************
*** 136,151 ****
compute_global_livein (bitmap livein, bitmap def_blocks)
{
basic_block bb, *worklist, *tos;
tos = worklist
= (basic_block *) xmalloc (sizeof (basic_block) * (last_basic_block +
1));
! /* Initialize the worklist. */
! FOR_EACH_BB (bb)
{
! if (bitmap_bit_p (livein, bb->index))
! *tos++ = bb;
! }
/* Iterate until the worklist is empty. */
while (tos != worklist)
--- 136,150 ----
compute_global_livein (bitmap livein, bitmap def_blocks)
{
basic_block bb, *worklist, *tos;
+ int i;
tos = worklist
= (basic_block *) xmalloc (sizeof (basic_block) * (last_basic_block +
1));
! EXECUTE_IF_SET_IN_BITMAP (livein, 0, i,
{
! *tos++ = BASIC_BLOCK (i);
! });
/* Iterate until the worklist is empty. */
while (tos != worklist)
***************
*** 244,251 ****
{
tree *use_p = VUSE_OP_PTR (vuses, i);
! if (prepare_operand_for_rename (use_p, &uid)
! && !TEST_BIT (kills, uid))
set_livein_block (*use_p, bb);
}
--- 243,249 ----
{
tree *use_p = VUSE_OP_PTR (vuses, i);
! if (prepare_operand_for_rename (use_p, &uid))
set_livein_block (*use_p, bb);
}
***************
*** 264,271 ****
{
VDEF_RESULT (vdefs, i) = VDEF_OP (vdefs, i);
! if (!TEST_BIT (kills, uid))
! set_livein_block (VDEF_OP (vdefs, i), bb);
set_def_block (VDEF_RESULT (vdefs, i), bb);
}
}
--- 262,268 ----
{
VDEF_RESULT (vdefs, i) = VDEF_OP (vdefs, i);
! set_livein_block (VDEF_OP (vdefs, i), bb);
set_def_block (VDEF_RESULT (vdefs, i), bb);
}
}