RE: [PATCH] Disable loop2_invariant for -Os

2012-07-09 Thread Zhenqiang Chen
>> >> 1) If -fira_loop_pressure is enabled, it reduces ~24% invariant motions in my >tests. But it does not help on total code size. Seams there is issue to update >the >"regs_needed" after moving an invariant out of the loop (My benchmark logs >show ~73% cases have more than one invariants moved)

Re: [PATCH] Disable loop2_invariant for -Os

2012-07-03 Thread Richard Guenther
On Tue, Jul 3, 2012 at 10:29 AM, Zhenqiang Chen wrote: >>-Original Message- >>From: Richard Guenther [mailto:richard.guent...@gmail.com] >>Sent: 2012年6月28日 17:24 >>To: Zhenqiang Chen >>Cc: gcc-patches@gcc.gnu.org >>Subject: Re: [PATCH] Disable loop2_i

RE: [PATCH] Disable loop2_invariant for -Os

2012-07-03 Thread Zhenqiang Chen
>-Original Message- >From: Richard Guenther [mailto:richard.guent...@gmail.com] >Sent: 2012年6月28日 17:24 >To: Zhenqiang Chen >Cc: gcc-patches@gcc.gnu.org >Subject: Re: [PATCH] Disable loop2_invariant for -Os > >On Thu, Jun 28, 2012 at 10:33 AM, Zhenqiang Chen >w

Re: [PATCH] Disable loop2_invariant for -Os

2012-06-28 Thread Richard Guenther
On Thu, Jun 28, 2012 at 10:33 AM, Zhenqiang Chen wrote: >>> diff --git a/gcc/loop-init.c b/gcc/loop-init.c index 03f8f61..5d8cf73 >>> 100644 >>> --- a/gcc/loop-init.c >>> +++ b/gcc/loop-init.c >>> @@ -273,6 +273,12 @@ struct rtl_opt_pass pass_rtl_loop_done = >>>  static bool >>>  gate_rtl_move_loo

RE: [PATCH] Disable loop2_invariant for -Os

2012-06-28 Thread Zhenqiang Chen
>-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 > wro

RE: [PATCH] Disable loop2_invariant for -Os

2012-06-28 Thread Zhenqiang Chen
>> diff --git a/gcc/loop-init.c b/gcc/loop-init.c index 03f8f61..5d8cf73 >> 100644 >> --- a/gcc/loop-init.c >> +++ b/gcc/loop-init.c >> @@ -273,6 +273,12 @@ struct rtl_opt_pass pass_rtl_loop_done = >>  static bool >>  gate_rtl_move_loop_invariants (void) >>  { >> +  /* In general, invariant motion

Re: [PATCH] Disable loop2_invariant for -Os

2012-06-27 Thread Steven Bosscher
On Wed, Jun 27, 2012 at 10:40 AM, Zhenqiang Chen 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 a

Re: [PATCH] Disable loop2_invariant for -Os

2012-06-27 Thread Richard Guenther
On Wed, Jun 27, 2012 at 10:40 AM, Zhenqiang Chen wrote: > Hi, > > In general, invariant motion itself can not reduce code size. It can expose CSE opportunities across loops though. > But it will > change the liverange of the invariant, which might lead to more spilling. "might" - indeed. I won

[PATCH] Disable loop2_invariant for -Os

2012-06-27 Thread Zhenqiang Chen
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. The patch disables loop2_invariant when optimizing for size. I measured the code size benefit for four targets based on CSiBE benchmark: ARM: 0.