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: [PATCH] rtlopt branch merge part 9 -- loop unrolling&peeling


On Sat, Feb 08, 2003 at 06:30:55PM +0100, Zdenek Dvorak wrote:
> 	* cse.c (count_reg_usage): Fix handling of REG_EQUAL notes.
> 
> 	* Makefile.in (loop-unroll.o): New.
> 	* cfgloop.h (UAP_PEEL, UAP_UNROLL, UAP_UNROLL_ALL): New.
> 	(unroll_and_peel_loops): Declare.
> 	* alias.c (init_alias_analysis): Flag_unroll_loops renamed to
> 	flag_old_unroll_loops.
> 	* loop.c (loop_invariant_p): Ditto.
> 	* unroll.c (unroll_loop): Flag_unroll_all_loops renamed to
> 	flag_old_unroll_all_loops.
> 	* flags.h (flag_unroll_loops): Renamed to flag_old_unroll_loops.
> 	(flag_unroll_all_loops): Renamed to flag_old_unroll_all_loops.
> 	* params.def (PARAM_MAX_UNROLLED_INSNS): Default value changed.
> 	(PARAM_MAX_AVERAGE_UNROLLED_INSNS, PARAM_MAX_UNROLL_TIMES,
> 	PARAM_MAX_PEELED_INSNS, PARAM_MAX_PEEL_TIMES,
> 	PARAM_MAX_COMPLETELY_PEELED_INSNS, PARAM_MAX_COMPLETELY_PEEL_TIMES,
> 	PARAM_MAX_ONCE_PEELED_INSNS): New.
> 	* toplev.h (flag_old_unroll_loops, flag_old_unroll_all_loops): New.
> 	(flag_unroll_loops, flag_unroll_all_loops): Used for new unroller
> 	instead of old one.
> 	(flag_peel_loops): New.
> 	(lang_independent_options): The new flags added.
> 	(rest_of_compilation): Call new unroller.
> 	(process_options): Setup flags for coexistence of old and new unroller.
> 	* doc/invoke.texi: Document new options.
> 	* doc/passes.texi: Document new unroller pass.

Ok.

> /* Check whether to peel LOOPS (depending on FLAGS) completely and do so.  */
> static void
> peel_loops_completely (loops, flags)
>      struct loops *loops;
>      int flags;
> {
...
>       /* Do not peel cold areas.  */
>       if (!maybe_hot_bb_p (loop->header))

Why does hotness come into it?  Shouldn't this be a code
size reduction in all cases?

>       if (!can_duplicate_loop_p (loop))

Likewise, why would we have to duplicate the loop at all?
Can't we modify it in situ?  Indeed, it would seem that 
not having to duplicate all that rtl would be a nice win.

> /* Unroll LOOP with constant number of iterations LOOP->LPT_DECISION.TIMES + 1
>    times.  The transformation does this: 
>    
>    for (i = 0; i < 102; i++)
>      body;
>    
>    ==>
>    
>    i = 0;
>    body; i++;
>    body; i++;
>    while (i < 102)
>      {
>        body; i++;
>        body; i++;
>        body; i++;
>        body; i++;
>      }

I would hope this would actually transform to a do-while?


r~


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