This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch 4/4] Allow loop prefetch code to speculatively prefetch non constant steps
- From: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- To: Christian Borntraeger <borntraeger at de dot ibm dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Richard Guenther <rguenther at suse dot de>, Changpeng Fang <Changpeng dot Fang at amd dot com>, Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Date: Fri, 7 May 2010 17:00:10 +0200
- Subject: Re: [patch 4/4] Allow loop prefetch code to speculatively prefetch non constant steps
- References: <20100507135917.951354000@de.ibm.com> <20100507140449.953746000@de.ibm.com>
Hi,
> This patch changes the prefetch code to accept non-constant step sizes
> for memory references in loops. If the step size is a constant integer
> the patch should not change the current behaviour.
>
> This patch uses a heuristic to speculatively activate prefetching for
> non-constant steps by prefetching "ahead" iterations in advance.
>
> This patch improves some testcases where the old prefetch code did not
> improve the performance (e.g. mcf).
OK, modulo coding style fixes:
> * tree-ssa-loop-prefetch.c (dump_mem_ref): Adopt debug code to
> handle a tree as step. this also checks for a constant int vs.
> non-constant but loop-invariant steps.
capital T in "this".
> ! if (cst_and_fits_in_hwi(ref->group->step))
> ! fprintf (file, HOST_WIDE_INT_PRINT_DEC, int_cst_value(ref->group->step));
Missing space before (. Repeats many times throughout the patch.
> ! else
> ! fprintf (file, "is non-constant but loop-invariant");
It might be useful to dump the step in this case, anyway.
> if (!analyze_ref (loop, &ref, &base, &step, &delta, stmt))
> return false;
> + /* if analyze_ref fails the default is a NULL_TREE. we can stop here */
Capital letters at the starts of sentences. Dot at the end.
> ! /* if the step size is non constant, we cannot calculate prefetch_mod */
Ditto.
> ! /* the step size is non-constant but loop-invariant. We use the
> ! heuristic to simply prefetch ahead iterations ahead. */
Ditto.
Zdenek