This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Eliminate more dead PHIs
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 07 Jan 2004 15:11:33 -0700
- Subject: [tree-ssa] Eliminate more dead PHIs
- Reply-to: law at redhat dot com
A few weeks ago I noticed that we were leaving PHI nodes for virtual
variables in the IL when the result of the PHI was never used.
I finally looked at it in more depth today. Would you believe that
more than 80% of the PHI nodes in the dce1 dumpfile for alias.c are
are for dead virtual variables! Egad.
Zdenek's changes help, but only slightly.
We never need to consider a PHI for a virtual variable inherently
necessary -- and that little trick eliminates a ton of totally
useless PHI nodes. Whee.
Bootstrapped and regression tested i686-pc-linux-gnu.
* tree-ssa-dce.c (find_useful_stmts): Do not consider PHIs for
virtual operands inherently necessary.
Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dce.c,v
retrieving revision 1.1.2.73
diff -c -3 -p -r1.1.2.73 tree-ssa-dce.c
*** tree-ssa-dce.c 6 Jan 2004 01:21:13 -0000 1.1.2.73
--- tree-ssa-dce.c 7 Jan 2004 22:05:11 -0000
*************** find_useful_stmts (void)
*** 219,225 ****
for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
{
clear_necessary (phi);
! if (need_to_preserve_store (PHI_RESULT (phi)))
mark_necessary (PHI_RESULT (phi), phi);
}
--- 219,233 ----
for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
{
clear_necessary (phi);
!
! /* PHIs for virtual variables do not directly affect code
! generation and need not be considered inherently necessary
! regardless of the bits set in their decl.
!
! Thus, we only need to mark PHIs for real variables which
! need their result preserved as being inherently necessary. */
! if (is_gimple_reg (PHI_RESULT (phi))
! && need_to_preserve_store (PHI_RESULT (phi)))
mark_necessary (PHI_RESULT (phi), phi);
}