diff options
Diffstat (limited to 'gcc/tree-ssa-loop-prefetch.c')
-rw-r--r-- | gcc/tree-ssa-loop-prefetch.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index 2fc901d..daf9956 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -716,6 +716,9 @@ prune_ref_by_group_reuse (struct mem_ref *ref, struct mem_ref *by, hit_from = ddown (delta_b, PREFETCH_BLOCK) * PREFETCH_BLOCK; prefetch_before = (hit_from - delta_r + step - 1) / step; + /* Do not reduce prefetch_before if we meet beyond cache size. */ + if (prefetch_before > abs (L2_CACHE_SIZE_BYTES / step)) + prefetch_before = PREFETCH_ALL; if (prefetch_before < ref->prefetch_before) ref->prefetch_before = prefetch_before; @@ -746,6 +749,9 @@ prune_ref_by_group_reuse (struct mem_ref *ref, struct mem_ref *by, reduced_prefetch_block, align_unit); if (miss_rate <= ACCEPTABLE_MISS_RATE) { + /* Do not reduce prefetch_before if we meet beyond cache size. */ + if (prefetch_before > L2_CACHE_SIZE_BYTES / PREFETCH_BLOCK) + prefetch_before = PREFETCH_ALL; if (prefetch_before < ref->prefetch_before) ref->prefetch_before = prefetch_before; |