This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch 4/4 v4] Allow loop prefetch code to speculatively prefetch non constant steps
Am Donnerstag 20 Mai 2010 00:25:48 schrieb H.J. Lu:
> On Wed, May 19, 2010 at 5:40 PM, Andreas Krebbel
> <krebbel@linux.vnet.ibm.com> wrote:
> > On 05/07/2010 10:04 PM, Christian Borntraeger wrote:
> >>
> >> 2010-05-07 Christian Borntraeger<borntraeger@de.ibm.com>
> >>
> >> * tree-ssa-loop-prefetch.c (mem_ref_group): Change step to tree.
> >> * tree-ssa-loop-prefetch.c (ar_data): Change step to tree.
> >> * 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.
> >> * tree-ssa-loop-prefetch.c (find_or_create_group): Change the sort
> >> algorithm to only consider steps that are constant ints.
> >> * tree-ssa-loop-prefetch.c (idx_analyze_ref): Adopt code to handle
> >> a tree instead of a HOST_WIDE_INT for step.
> >> * tree-ssa-loop-prefetch.c (gather_memory_references_ref): Handle
> >> tree instead of int and be prepared to see a NULL_TREE.
> >> * tree-ssa-loop-prefetch.c (prune_ref_by_self_reuse): Do not prune
> >> prefetches if the step cannot be calculated at compile time.
> >> * tree-ssa-loop-prefetch.c (prune_ref_by_group_reuse): Do not
> >> prune
> >> prefetches if the step cannot be calculated at compile time.
> >> * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Issue prefetches
> >> for non-constant but loop-invariant steps.
> >
> > Applied to mainline. Thanks!
> >
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44203
Indeed. I think I found a typo when handling array prefetches:
--- gcc/tree-ssa-loop-prefetch.c (Revision 159557)
+++ gcc/tree-ssa-loop-prefetch.c (Arbeitskopie)
@@ -440,7 +440,7 @@
*ar_data->step = fold_build2 (MULT_EXPR, sizetype,
fold_convert (sizetype, *ar_data->step),
- fold_convert (sizetype, step));
+ fold_convert (sizetype, stepsize));
idelta *= imult;
}
I will test and update this fix.
Christian
PS: most prefetch testcases contain something like
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-require-effective-target ilp32 } */
which explains why I have not seen these regressions on s390x. I will check if
I can adopt these tests to run on more platforms.