This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] tree-ssa-threadupdate.c: Speed up threadblock.
- 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: Mon, 01 Nov 2004 14:41:16 -0700
- Subject: Re: [patch] tree-ssa-threadupdate.c: Speed up threadblock.
- Organization: Red Hat, Inc
- References: <20041030.083325.98559564.kazu@cs.umass.edu>
- Reply-to: law at redhat dot com
On Sat, 2004-10-30 at 08:33 -0400, Kazu Hirata wrote:
> Hi,
>
> Attached is a patch to speed up threadblock.
>
> threadblock first adds PHI arguments to the basic block that we wish
> to redirect an edge to before we actually redirect the edge. It turns
> out that this way of implementation would call phi_arg_from_edge more
> than necessary. Here is why.
>
> 1. copy_phis_to_block looks for PHI arguments using an edge that is
> about to be redirected.
>
> 2. ssa_redirect_edge, called from redirect_edge_and_branch, stores
> into PENDING_STMT the PHI arguments from the same edge.
>
> Both of these operations use phi_arg_from_edge to locate PHI arguments
> on the edge being redirected.
>
> If we call redirect_edge_and_branch first, we can add PHI arguments to
> the new edge using PENDING_STMT, which is stuffed by
> ssa_redirect_edge. Note that the running time of phi_arg_from_edge on
> edge E is proportional to EDGE_COUNT (E->dest->preds).
>
> Tested on i686-pc-linux-gnu. OK to apply?
>
> p.s.
> As a good side effect of this patch, we create the redirected edge E
> *before* we add PHI arguments associated with E. This makes "O(1) PHI
> argument look-up" easier to implement because given E's index in the
> corresponding edge vector, we know where we should put the new PHI
> arguments in the array of PHI arguments.
>
> Kazu Hirata
>
> 2004-10-30 Kazu Hirata <kazu@cs.umass.edu>
>
> * tree-ssa-threadupdate.c (copy_phis_to_block): Install PHI
> arguments using PENDING_STMT.
> (thread_block): Call copy_phis_to_block after redirecting an
> edge.
This is fine. Please install this patch.
Thanks,
Jeff