This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] [RFC] loop versioning
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Devang Patel <dpatel at apple dot com>
- Cc: Richard Henderson <rth at redhat dot com>,Dorit Naishlos <DORIT at il dot ibm dot com>, gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Wed, 7 Jan 2004 02:24:32 +0100
- Subject: Re: [tree-ssa] [RFC] loop versioning
- References: <D2D0AF1C-4085-11D8-A713-000393A91CAA@apple.com>
Hello,
> >Anyway, you should know that there are already routines to copy
> >statements and blocks. So all of this code looks redundant.
>
> tree_duplicate_bb () is more suitable to copy loop header. For
> other basic blocks inside loop, while duplicating a basic block
> I may not have corresponding edge available.
it is trivial to update tree_duplicate_bb to not require the edge
(similarly as cfg_layout_duplicate_bb does not).
> Because it is possible
> that bb at other end of edge does not yet have corresponding
> duplicate bb. So what I do is, duplicate all basic blocks and
> then make edge for second loop by following edges of original loop.
> Plus there can be more than one incoming edges and tree_duplicate_bb()
> does not handle it.
It does.
> As I understand tree_duplicate_bb() performs this operation
>
> before
> ---- edge e1 ----> [bb1]
>
> after
> --- edge e1 --+ [bb1]
> |
> +---> [bb2]
no, it transforms
---- -------
\ /
----- bb
/ \
---- --------
into
---- -------
\ / /
----- bb -----
X
bb' ----
/ \ \
---- -------
> What I need to do for loop versioning is:
>
> before
> ---- edge e1 ---> [bb1] ---- edge e2 --->
> after
> ---- edge e1 ---> [bb1] ---- edge e2 --->
> ---- edge e21 ---> [bb21] ---- edge e22 --->
>
>
> And comment on top of tree_duplicate_bb () says that it does not
> work over SSA. At the moment, I'm trying to make loop versioning
> work over SSA.
Updating SSA after code duplication is nontrivial (in general equivalent
to doing a full rewrite for the definitions in the duplicated code).
This is why there is no handling for it built into tree_duplicate_bb
itself, since it is expected to be done either by using generic ssa
building code, or handling the special cases separately.
Zdenek