On Thu, Jan 18, 2018 at 8:03 AM, Sebastian Perta
<sebastian.pe...@renesas.com> wrote:
> Hi,
>
> Thank you!
> As the description says this finds equivalent functions, I would like to find 
> identical sequences inside
> functions but at least this will provide all the up to date tools to compare 
> code sequences, thank you again!

There is already some identical sequence finding (code hoisting) in
GCC 7 (and above), see
https://gcc.gnu.org/ml/gcc-patches/2016-07/msg00360.html
for the patch.

Thanks,
Andrew

>
> Best Regards,
> Sebastian
>
>
>> -----Original Message-----
>> From: Martin Jambor [mailto:mjam...@suse.cz]
>> Sent: 18 January 2018 15:18
>> To: Sebastian Perta <sebastian.pe...@renesas.com>; gcc-
>> patc...@gcc.gnu.org
>> Cc: l...@gcc.gnu.org
>> Subject: Re: New code merge optimization?
>>
>> Hi,
>>
>> On Thu, Jan 18 2018, Sebastian Perta wrote:
>> > Hello,
>> >
>> > I am interested in implementing a new pass in gcc to merge identical
>> > sequences of code in GCC to be used mainly for RL78.
>> > The commercial RL78 compilers have such algorithms implemented and
>> they make
>> > quite good use of it.
>> > Opportunities arise from the limited capabilities of RL78, for other 
>> > targets
>> > this might be a lot less useful.
>> >
>> > A while ago I found the following:
>> > https://www.gnu.org/software/gcc/projects/cfo.html
>> > And I ported all algorithms to gcc 4.9.2 and tried it on RL78 and RX and
>> > this is what I found out:
>> > For RX: no visible improvements with any of them
>> > For RL78: some minor improvements only with -frtl-seqbastr:
>> > Compiling all the C files from gcc/testsuite/gcc.c-torture/execute/*c  with
>> > "-Os" and "-Os  -frtl-seqabstr" (using the modified gcc 4.9.2)
>> > The algorithm was effective only in 60 files(out of 1643 files, that's only
>> > 0.03% of the files currently present in 
>> > gcc/testsuite/gcc.c-torture/execute)
>> > On those 60 files I got an average of 6.5% improvement with the best
>> > improvement for pr58574.c (36.4%).
>> >
>> > What do you think: is it worthwhile porting this to the trunk or I will 
>> > just
>> > waste my time?
>> > Or should I start fresh? Maybe start from here:
>> > http://llvm.org/docs/MergeFunctions.html?
>>
>> Martin Liška contributed identical code folding to GCC quite a few years
>> ago now.  Look up the -fipa-icf option.  If that is not enough for you,
>> starting from that seems more natural.
>>
>> Martin
>>
>> >
>> > Gimple or rtl?
>> > I suppose the preferred way will be to do this in gimple; however based on
>> > what I did so far,  it's more likely to find identical sequences in rtl 
>> > (for
>> > RL78).
>> >
>> > Any thoughts? Thank you!
>> >
>> > Best Regards,
>> > Sebastian
>
>
>
> Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, 
> Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered 
> No. 04586709.

Reply via email to