public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Extra invariant motion step after ivopt
@ 2011-07-11  9:36 Andreas Krebbel
  2011-07-11 10:18 ` Richard Guenther
  2011-07-12  6:42 ` H.J. Lu
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Krebbel @ 2011-07-11  9:36 UTC (permalink / raw)
  To: gcc-patches

Hi,

with the changes in the IVopts pass from last year I see a reduced
number of induction variables used for the first of the 3 hotloops in
the 436.cactus benchmark:

http://gcc.gnu.org/viewcvs?view=revision&revision=162653

Which leads to an heavily increased number of instructions in the body
of the first loop in the resulting binary:

with GCC 4.5: BB 4: 52  <- number of instructions
with GCC 4.6: BB 4: 110 <- similiar result with GCC head

With GCC 4.6 a lot of loop invariant integer arithmetic is done in
order to calculate the addresses which are used to access the array
fields.

Adding another invariant motion pass improves the loop even beyond the
4.5 result:

with GCC 4.6 + attached patch: BB 4: 47

The benchmark result for 436.cactus only improves by about 2% since
the first loop is not actually the "hottest" in the trio but the code
is actually much better.

I've not been able to measure the compile time overhead. Out of 10
measurements compiling the cactus testcase the minimum of the compile
times was even lower then before. Perhaps having less instructions in
the loop body made other passes faster.  Overall I expect a very small
compile time increase.

Ok for mainline?

Bye,

-Andreas-


2011-07-11  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	* passes.c (init_optimization_passes): Add invariant motion pass
	after induction variable optimization.

Index: gcc/passes.c
===================================================================
*** gcc/passes.c.orig
--- gcc/passes.c
*************** init_optimization_passes (void)
*** 1363,1368 ****
--- 1363,1369 ----
  	  NEXT_PASS (pass_parallelize_loops);
  	  NEXT_PASS (pass_loop_prefetch);
  	  NEXT_PASS (pass_iv_optimize);
+ 	  NEXT_PASS (pass_lim);
  	  NEXT_PASS (pass_tree_loop_done);
  	}
        NEXT_PASS (pass_cse_reciprocals);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Extra invariant motion step after ivopt
  2011-07-11  9:36 [PATCH] Extra invariant motion step after ivopt Andreas Krebbel
@ 2011-07-11 10:18 ` Richard Guenther
  2011-07-12  6:42 ` H.J. Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2011-07-11 10:18 UTC (permalink / raw)
  To: Andreas Krebbel; +Cc: gcc-patches

On Mon, Jul 11, 2011 at 10:50 AM, Andreas Krebbel
<krebbel@linux.vnet.ibm.com> wrote:
> Hi,
>
> with the changes in the IVopts pass from last year I see a reduced
> number of induction variables used for the first of the 3 hotloops in
> the 436.cactus benchmark:
>
> http://gcc.gnu.org/viewcvs?view=revision&revision=162653
>
> Which leads to an heavily increased number of instructions in the body
> of the first loop in the resulting binary:
>
> with GCC 4.5: BB 4: 52  <- number of instructions
> with GCC 4.6: BB 4: 110 <- similiar result with GCC head
>
> With GCC 4.6 a lot of loop invariant integer arithmetic is done in
> order to calculate the addresses which are used to access the array
> fields.
>
> Adding another invariant motion pass improves the loop even beyond the
> 4.5 result:
>
> with GCC 4.6 + attached patch: BB 4: 47
>
> The benchmark result for 436.cactus only improves by about 2% since
> the first loop is not actually the "hottest" in the trio but the code
> is actually much better.
>
> I've not been able to measure the compile time overhead. Out of 10
> measurements compiling the cactus testcase the minimum of the compile
> times was even lower then before. Perhaps having less instructions in
> the loop body made other passes faster.  Overall I expect a very small
> compile time increase.
>
> Ok for mainline?

Ok.

Thanks,
Richard.

> Bye,
>
> -Andreas-
>
>
> 2011-07-11  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
>
>        * passes.c (init_optimization_passes): Add invariant motion pass
>        after induction variable optimization.
>
> Index: gcc/passes.c
> ===================================================================
> *** gcc/passes.c.orig
> --- gcc/passes.c
> *************** init_optimization_passes (void)
> *** 1363,1368 ****
> --- 1363,1369 ----
>          NEXT_PASS (pass_parallelize_loops);
>          NEXT_PASS (pass_loop_prefetch);
>          NEXT_PASS (pass_iv_optimize);
> +         NEXT_PASS (pass_lim);
>          NEXT_PASS (pass_tree_loop_done);
>        }
>        NEXT_PASS (pass_cse_reciprocals);
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Extra invariant motion step after ivopt
  2011-07-11  9:36 [PATCH] Extra invariant motion step after ivopt Andreas Krebbel
  2011-07-11 10:18 ` Richard Guenther
@ 2011-07-12  6:42 ` H.J. Lu
  1 sibling, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2011-07-12  6:42 UTC (permalink / raw)
  To: Andreas Krebbel; +Cc: gcc-patches

On Mon, Jul 11, 2011 at 1:50 AM, Andreas Krebbel
<krebbel@linux.vnet.ibm.com> wrote:
> Hi,
>
> with the changes in the IVopts pass from last year I see a reduced
> number of induction variables used for the first of the 3 hotloops in
> the 436.cactus benchmark:
>
> http://gcc.gnu.org/viewcvs?view=revision&revision=162653
>
> Which leads to an heavily increased number of instructions in the body
> of the first loop in the resulting binary:
>
> with GCC 4.5: BB 4: 52  <- number of instructions
> with GCC 4.6: BB 4: 110 <- similiar result with GCC head
>
> With GCC 4.6 a lot of loop invariant integer arithmetic is done in
> order to calculate the addresses which are used to access the array
> fields.
>
> Adding another invariant motion pass improves the loop even beyond the
> 4.5 result:
>
> with GCC 4.6 + attached patch: BB 4: 47
>
> The benchmark result for 436.cactus only improves by about 2% since
> the first loop is not actually the "hottest" in the trio but the code
> is actually much better.
>
> I've not been able to measure the compile time overhead. Out of 10
> measurements compiling the cactus testcase the minimum of the compile
> times was even lower then before. Perhaps having less instructions in
> the loop body made other passes faster.  Overall I expect a very small
> compile time increase.
>
> Ok for mainline?
>
> Bye,
>
> -Andreas-
>
>
> 2011-07-11  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
>
>        * passes.c (init_optimization_passes): Add invariant motion pass
>        after induction variable optimization.
>

This may have caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49711


-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-12  5:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11  9:36 [PATCH] Extra invariant motion step after ivopt Andreas Krebbel
2011-07-11 10:18 ` Richard Guenther
2011-07-12  6:42 ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).