>-----Original Message----- >From: Steven Bosscher [mailto:stevenb....@gmail.com] >Sent: 2012年6月27日 16:54 >To: Zhenqiang Chen >Cc: gcc-patches@gcc.gnu.org >Subject: Re: [PATCH] Disable loop2_invariant for -Os > >On Wed, Jun 27, 2012 at 10:40 AM, Zhenqiang Chen ><zhenqiang.c...@arm.com> wrote: >> Hi, >> >> In general, invariant motion itself can not reduce code size. But it >> will change the liverange of the invariant, which might lead to more spilling. > >This may be true for ARM but it's not true in general. Sometimes loop-invariant
Benchmark tests show it also benefits MIPS, PPC and X86 for code size. >address arithmetic, that is not exposed in GIMPLE, is profitable to hoist out of >the loop. See e.g. PR41026 (for which I still have a patch in the queue). >If this goes in anyway, please mention PR39837 in your ChangeLog entry. It can not handle the case. Thanks! -Zhenqiang