This is the mail archive of the gcc-patches@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: [lno] [patch] vectorization with unknown loop bound


On May 17, 2004, at 18:01 PM, Devang Patel wrote:

> On May 17, 2004, at 7:10 AM, Olga Golovanevsky wrote:

> > I used some static functions from tree-ssa-loop-manip.c and
> > cfgloopmanip.c, as well the function force_gimple_operand() from
> > tree-ssa-loop-ivopts.c, so I changed these functions to non-static.
> > Alternatively it was possible to make this loop transformation
> > generic, that is a question whether it is worth doing.

> If tree_ssa_loop_version () is used then some of the code
> duplication can be avoided. But it can be done later.

How would you suggest to use tree_ssa_loop_version () function?

I looked at it before starting implementation also as at
tree-duplicate-loop-to-header-edge () and
duplicate-loop-to-header-edge ().

In my understanding, later two function in general
do the following:
      - sequentially concatenate basic blocks of loop
a given number of times
      - straiten loop latch edges in order to generate one loop
      - update ssa info (phis, names,...) of loop copies

The  tree_ssa_loop_version () function uses loopify ()
that in addition to loopifying bundle of basic blocks also
redirects a control flow to a switch basic block.

My case is simpler and different.
I just need to duplicate loop as it is:

for (i = 0; i < n; i++)
  xxx ();
       ||
       \/
for (i = 0; i < n; i++)
  xxx ();
for (; i < n; i++)
  xxx ();

While I still need to copy basic blocks, fixing phis and
manipulations on the control flow are different.
Am I missing something?



                                                                                                                                       
                      Devang Patel                                                                                                     
                      <dpatel@apple.com        To:       Olga Golovanevsky/Haifa/IBM@IBMIL                                             
                      >                        cc:       Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>, Sebastian Pop               
                                                <sebastian.pop@cri.ensmp.fr>, Dorit Naishlos/Haifa/IBM@IBMIL, GCC Patches              
                      17/05/2004 21:01          <gcc-patches@gcc.gnu.org>                                                              
                                               Subject:  Re: [lno] [patch] vectorization with unknown loop bound                       
                                                                                                                                       
                                                                                                                                       
                                                                                                                                       




On May 17, 2004, at 7:10 AM, Olga Golovanevsky wrote:

> I used some static functions from tree-ssa-loop-manip.c and
> cfgloopmanip.c, as well the function force_gimple_operand() from
> tree-ssa-loop-ivopts.c, so I changed these functions to non-static.
> Alternatively it was possible to make this loop transformation
> generic, that is a question whether it is worth doing.

If tree_ssa_loop_version () is used then some of the code
duplication can be avoided. But it can be done later.

> +   /* If the loop has symbolic number of iterations 'n'
> +      (i.e. it's not a compile time constant),
> +      then an epilog loop need to be created. We therefore duplicate
> +      the initial loop. The original loop will be vectorized, and
> will compute
> +      (n/VF) iterations. The second copy will remain serial and
> compute
> +      the remaining (n%VF) iterations. (VF is the vectorization
> factor).  */

Any reason for not using nested loops approach here? e.g.

             for (i=0; i<N; i = i + VF)
                         for (j=i; j < i + VF && j < N; j++)
                                     ...

I am just curious.

--
Devang





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