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


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


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