From 9eb18343f69d41c48f7f9954d4d7309d49c5c284 Mon Sep 17 00:00:00 2001 From: Changpeng Fang Date: Fri, 4 Jun 2010 14:02:54 -0700 Subject: [PATCH 3/3] Limit non-constant step prefetching only to the innermost loops. * tree-ssa-loop-prefetch.c (gather_memory_references_ref): Do not the gather memory reference in the outer loop if the step is not a constant. --- gcc/tree-ssa-loop-prefetch.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index d914e2d..750ee2e 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -510,6 +510,10 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs, if (step == NULL_TREE) return false; + /* Limit non-constant step prefetching only to the innermost loops. */ + if (!cst_and_fits_in_hwi (step) && loop->inner != NULL) + return false; + /* Now we know that REF = &BASE + STEP * iter + DELTA, where DELTA and STEP are integer constants. */ agrp = find_or_create_group (refs, base, step); -- 1.6.3.3