This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: Patch to handle perfect loop unrolling in tree_transform_and_unroll_loop
BTW: the following lines in original tree_transform_and_unroll_loop (I didn't change) are
problematic. Some complex loops won't meet requirements of single_pred(loop->latch) (e.g., 20060905-1.c)
should this function is called to unroll them.
exit_bb = single_pred (loop->latch);
new_exit = find_edge (exit_bb, rest);
new_exit->count = loop_preheader_edge (loop)->count;
new_exit->probability = REG_BR_PROB_BASE / (new_est_niter + 1);
rest->count += new_exit->count;
rest->frequency += EDGE_FREQUENCY (new_exit);
new_nonexit = single_pred_edge (loop->latch);
prob = new_nonexit->probability;
new_nonexit->probability = REG_BR_PROB_BASE - new_exit->probability;
new_nonexit->count = exit_bb->count - new_exit->count;
> -----Original Message-----
> From: fearyourself@gmail.com [mailto:fearyourself@gmail.com]
> On Behalf Of Jean Christophe Beyler
> Sent: 28 October 2009 15:24
> To: Bingfeng Mei
> Cc: gcc-patches@gcc.gnu.org; Zdenek Dvorak
> Subject: Re: Patch to handle perfect loop unrolling in
> tree_transform_and_unroll_loop
>
> I am only looking at your patch so I haven't tried your code, so it is
> very possible some of these comments are simply stupid:
>
> - I wonder the usefulness of :
> + if(perfect_unrolling)
> + {
> + new_exit = exit;
> + rest = exit->dest;
> + new_est_niter = est_niter / factor;
> + }
>
> as far as I can tell, rest is only used in the non perfect case
>
> - Not important at all:
> + gcc_assert(EDGE_COUNT(exit_bb->succs) == 2);
> doesn't follow the normal indentation for the '('
>
> - More to the point, I did something similar except I added a test to
> see if the factor requested by the user was above the limit of
> n_iters. If so, I say that the unrolling is perfect and issue a
> warning.
>
> Do you want me to look a bit more?
> Jc
>
> On Wed, Oct 28, 2009 at 10:43 AM, Bingfeng Mei
> <bmei@broadcom.com> wrote:
> > Hello,
> > This patch is to handle perfect loop unrolling as
> > discussed in http://gcc.gnu.org/ml/gcc/2009-10/msg00333.html.
> >
> > I merged the original code into tree_transform_and_unroll_loop,
> > and added some code to get probability/frequency right.
> >
> > This is related to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36712
> > A tree-level unrolling pass will just call this modified function.
> > I will submit a separate patch if needed.
> >
> > 2009-10-28 ?Bingfeng Mei <bmei@broadcom.com>
> >
> > ? ? ? ?* tree_transform_and_unroll_loop
> (tree_transform_and_unroll_loop):
> > ? ? ? ?To handle perfect loop unrolling.
> (perfect_loop_unrolling_p): New function
> > ? ? ? ?to check whether a loop can perfect unrolling.
> >
> > Cheers,
> > Bingfeng Mei
> >
> >
>
>