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
