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: gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Thu, 8 Jan 2004 02:52:50 +0100
- Subject: Re: [tree-ssa] [RFC] loop versioning
- References: <F9EF92F2-414F-11D8-968B-000393A91CAA@apple.com>
Hello,
> >>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).
>
> true, but based on your example, you can see that its purpose is
> different.
ummm.... looking at your code, it does something very similar to loop
unswitching. It might be a good idea to use the code we already have
for this (see loop-unswitch.c and related functions in cfgloop*.c and
cfglayout.c). It would save you time with handling many technical
details (updating dominators and loop structures, handling irreducible
regions). It would of course be needed to modify the code a bit so that
it works both over rtl and trees (using cfghooks.h), but it should be
quite straightforward to do.
> >Updating SSA after code duplication is nontrivial (in general
> >equivalent
> >to doing a full rewrite for the definitions in the duplicated code).
>
> yup, but I'm willing to give it a shot.
Fine, that definitely would be useful to have. I would however stronly
recommend you to have a look on functions in tree-ssa.c, so that you
don't end up unnecesarily writing the same code again.
> What if I rename it to tree_duplicate_head_bb () and implement
> new duplicate_bb() as Jan suggested ?
Please avoid creating unnecessary code duplication. If you need to
extend functionality provided by tree_duplicate_bb in some way, it would
be probably preferable to either extend it, or use it as a subroutine and
just add the extra functionality you need.
As for Honza's suggestions, I assume he was speaking about something like
cfglayout.c:copy_bbs.
Zdenek