https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80155

--- Comment #26 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
(In reply to rguent...@suse.de from comment #25)
> On Fri, 7 Apr 2017, thopre01 at gcc dot gnu.org wrote:
> 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80155
> > 
> > --- Comment #24 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
> > (In reply to rguent...@suse.de from comment #23)
> > > On Fri, 7 Apr 2017, thopre01 at gcc dot gnu.org wrote:
> > > 
> > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80155
> > > > 
> > > > --- Comment #22 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> 
> > > > ---
> > > > (In reply to Thomas Preud'homme from comment #21)
> > > > > 
> > > > > I can see this behavior for Cortex-M0+ indeed but the results are 
> > > > > different
> > > > > for Cortex-M7 for me:
> > > > > 
> > > > > <with code hoisting>
> > > > > % arm-none-linux-gnueabi-gcc -S ~/cortex-m0plus_reproducer.c -O2
> > > > > -mcpu=cortex-m7 -mthumb -fdump-tree-pre-details -fdump-tree-crited 
> > > > > -fdump-tree-all -funroll-all-loops
> > > > > 
> > > > > % grep push cortex-m0plus_reproducer.s
> > > > >         push    {r4, r5}
> > > > > 
> > > > > 
> > > > > <without code hoisting>
> > > > > % arm-none-linux-gnueabi-gcc -S ~/cortex-m0plus_reproducer.c -O2
> > > > > -mcpu=cortex-m7 -mthumb -fdump-tree-pre-details -fdump-tree-crited 
> > > > > -fdump-tree-all -funroll-all-loops -fno-code-hoisting
> > > > > 
> > > > > % grep push cortex-m0plus_reproducer.s
> > > > >         push    {r4}
> > > > > 
> > > > > Would you mind checking again?
> > > > 
> > > > btw, this toolchain was built on 2017-04-04 in case that's the issue.
> > > 
> > > Ok, I can reproduce it now.  With the proposed patch to fix the other
> > > case it regresses with -fno-code-hoisting though (comment #9 plus fix).
> > > 
> > > Note that code-hosting is simply doing it's job here, hoisting common
> > > code out of a switch.
> > 
> > I understand that. Code is smaller so it's definitely worthwhile at -Os. 
> > But it
> > sometimes lead to worse performance due to more spilling.
> 
> But there's no good way to estimate that.  We have tons of transforms
> that have the issue of being "sometimes worse"

Yes true.

By the way, your first patch did improve things a bit. If it's not too invasive
could it be possible to commit it for GCC 7?

I think I'll try the approach you suggested in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77498#c10 and see if I get some
better results.

Reply via email to