On Tue, Nov 1, 2011 at 2:53 AM, Richard Guenther
<richard.guent...@gmail.com> wrote:
> On Tue, Nov 1, 2011 at 1:46 AM, Teresa Johnson <tejohn...@google.com> wrote:
>> This patch is for google-main only.
>>
>> Tested with bootstrap and regression tests.
>>
>> Print unroll and peel factors along with loop source position under 
>> -fopt-info.
>>
>> Teresa
>>
>> 2011-10-31   Teresa Johnson  <tejohn...@google.com>
>>
>>        * common.opt (fopt-info): Disable -fopt-info by default.
>>        * loop-unroll.c (report_unroll_peel): New function.
>>        (unroll_and_peel_loops): Call record_loop_exits for later use.
>>        (peel_loops_completely): Print the loop source position in dump
>>        info and emit note under -fopt-info.
>>        (decide_unroll_and_peeling): Ditto.
>>        (decide_peel_once_rolling): Record peel factor for use in note
>>        emission.
>>        (decide_peel_completely): Ditto.
>>        * cfgloop.c (get_loop_location): New function.
>>        * cfgloop.h (get_loop_location): Ditto.
>>        * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Emit note
>>        under -fopt-info.
>>
>> Index: tree-ssa-loop-ivcanon.c
>> ===================================================================
>> --- tree-ssa-loop-ivcanon.c     (revision 180437)
>> +++ tree-ssa-loop-ivcanon.c     (working copy)
>> @@ -52,6 +52,7 @@
>>  #include "flags.h"
>>  #include "tree-inline.h"
>>  #include "target.h"
>> +#include "diagnostic.h"
>>
>>  /* Specifies types of loops that may be unrolled.  */
>>
>> @@ -443,6 +444,17 @@
>>     fprintf (dump_file, "Unrolled loop %d completely by factor %d.\n",
>>              loop->num, (int) n_unroll);
>>
>> +  if (flag_opt_info >= OPT_INFO_MIN)
>> +    {
>> +      location_t locus;
>> +      locus = gimple_location (cond);
>> +
>> +      inform (locus, "Completely Unroll loop by %d (execution count
>> %d, const iterations %d)",
>> +              (int) n_unroll,
>> +              (int) loop->header->count,
>> +              (int) TREE_INT_CST_LOW(niter));
>> +    }
>> +
>
> And this is exactly what I mean with code-duplication.

Yes, we agree with you and we will improve it after this.

>Two lines above
> we already have "Unroled loop %d completely by factor %d", not only
> do you duplicate some diagnostic printing about this fact, you
> put in useless info (complete unroll by N of a loop executing M (?! that's
> surely N as well) times,

M!=N. M is used to indicate how hot the loop is.

David

>const iterations O (?! that's surely N as well ...).
>
> Richard.
>

Reply via email to