This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] tree-ssa-threadupdate.c: Remove copy_phis_to_block.
- From: Jeffrey A Law <law at redhat dot com>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 09 Nov 2004 10:08:37 -0700
- Subject: Re: [patch] tree-ssa-threadupdate.c: Remove copy_phis_to_block.
- Organization: Red Hat, Inc
- References: <20041107.012014.01283912.kazu@cs.umass.edu>
- Reply-to: law at redhat dot com
On Sun, 2004-11-07 at 01:20 -0500, Kazu Hirata wrote:
> Hi,
>
> Attached is a patch to remove copy_phis_to_block as it is a duplicate
> of tree-ssa.c:flush_pending_stmt.
>
> thread_block makes several copies of the basic block that a jump is
> threaded through and then calls copy_phis_to_block to install
> appropriate PHI arguments to each copy. Note that
>
> 1) these copies are made while keeping the order of PHI nodes
> identical to the original basic block, and that
>
> 2) ssa_redirect_edge stuffs PENDING_STMT in the same order as the PHI
> nodes at the original basic block.
>
> so the order of PHI nodes in PENDING_STMT and those at each copy are
> the same. Thus copy_phis_to_block could walk through PENDING_STMT and
> the PHI chain at the same time like so:
>
> for (phi = phi_nodes (e->dest), arg = PENDING_STMT (e);
> phi;
> phi = TREE_CHAIN (phi), arg = TREE_CHAIN (arg))
> {
> :
> :
> }
>
> rather than searching for a PHI node for every element in the linked
> list pointed to by PENDING_STMT.
>
> It turns out that once we implement the idea above, copy_phis_to_block
> ends up being identical to tree-ssa.c:flush_pending_stmt, so the patch
> simply replaces the call to copy_phis_to_block with
> flush_pending_stmt.
>
> Tested on i686-pc-linux-gnu. OK to apply?
>
> Kazu Hirata
>
> 2004-11-07 Kazu Hirata <kazu@cs.umass.edu>
>
> * tree-ssa-threadupdate.c (copy_phis_to_block): Remove.
> (thread_block): Call flush_pending_stmt instead of
> copy_phis_to_block.
OK.
jeff