This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] [RFC] loop versioning



On Jan 7, 2004, at 5:52 PM, Zdenek Dvorak wrote:


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.

yes, this will be very helpful. Thank you.


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.

I did not know copy_bbs() already exist!


Zdenek

--
Devang


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]