2010-06-28 Christian Borntraeger <borntraeger@de.ibm.com>
PR middle-end/44576
* tree-ssa-loop-prefetch.c (PREFETCH_MAX_REFS_PER_LOOP): New.
* (loop_prefetch_arrays): Do not prefetch if the loop contains
too many memory references.
===================================================================
*************** struct mem_ref_group
#define PREFETCH_MOD_TO_UNROLL_FACTOR_RATIO 4
#endif
+ /* Some of the prefetch calculations have >=quadratic complexity. We want
+ to avoid huge compile times and, therefore, want to limit the amount of
+ memory references per loop where we consider prefetching. In addition,
+ if a loop has a huge amount of memory references it is very likely that
+ the prefetch is not necessary due to reuse effects or even worse the
+ prefetch might compete with other cache lines that are used within the
+ loop. */
+ #ifndef PREFETCH_MAX_REFS_PER_LOOP
+ #define PREFETCH_MAX_REFS_PER_LOOP 200
+ #endif
+
/* The memory reference. */
struct mem_ref
*************** loop_prefetch_arrays (struct loop *loop)
/* Step 1: gather the memory references. */
refs = gather_memory_references (loop, &no_other_refs, &mem_ref_count);
+ if (mem_ref_count > PREFETCH_MAX_REFS_PER_LOOP) {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Ignoring loop: too many references (%d)\n",
+ mem_ref_count);
+ goto fail;
+ }
/* Step 2: estimate the reuse effects. */
prune_by_reuse (refs);