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: [google] Enable loop unroll/peel notes under -fopt-info


Hi Richard,

Once we have a uniform way to emit notes to either stderr or dump, as
you and David had discussed in the earlier thread, we can merge these
two messages. The advantage with the new messages, besides going to
stderr, is that the source position information is being emitted since
it is a note. I agree that for complete unrolls the constant number of
iterations can be omitted (but it is useful for the other types of
unrolls/peels). But the execution count is something different - it
includes the number of times the loop header executes based on profile
information (i.e. iterations*# times loop is entered).

Thanks,
Teresa


On Tue, Nov 1, 2011 at 2:53 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Tue, Nov 1, 2011 at 1:46 AM, Teresa Johnson <tejohnson@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 ?<tejohnson@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. ?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, const iterations O (?! that's surely N as well ...).
>
> Richard.
>



-- 
Teresa Johnson?|?Software Engineer?|?tejohnson@google.com?|?408-460-2413


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