diff options
author | Changpeng Fang <changpeng.fang@amd.com> | 2010-05-07 17:26:02 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2010-05-07 17:26:02 +0000 |
commit | 9bf4598b0df6d72a5b10dc3acf82034c42d0e220 (patch) | |
tree | 5749b3a61855b4d88b29ee98bebe99c3111c7654 /gcc/tree-ssa-loop-prefetch.c | |
parent | ccacf0e1937278d8db2d0be7f6b45d2fce6afc69 (diff) | |
download | gcc-9bf4598b0df6d72a5b10dc3acf82034c42d0e220.zip gcc-9bf4598b0df6d72a5b10dc3acf82034c42d0e220.tar.gz gcc-9bf4598b0df6d72a5b10dc3acf82034c42d0e220.tar.bz2 |
Define the TRIP_COUNT_TO_AHEAD_RATIO heuristic.
2010-05-07 Changpeng Fang <changpeng.fang@amd.com>
* tree-ssa-loop-prefetch.c (TRIP_COUNT_TO_AHEAD_RATIO): New.
(is_loop_prefetching_profitable): Do not insert prefetches
when the trip count is not at least TRIP_COUNT_TO_AHEAD_RATIO
times the prefetch ahead distance.
From-SVN: r159163
Diffstat (limited to 'gcc/tree-ssa-loop-prefetch.c')
-rw-r--r-- | gcc/tree-ssa-loop-prefetch.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index 38d8f23..7497616 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -199,6 +199,18 @@ along with GCC; see the file COPYING3. If not see #define FENCE_FOLLOWING_MOVNT NULL_TREE #endif +/* It is not profitable to prefetch when the trip count is not at + least TRIP_COUNT_TO_AHEAD_RATIO times the prefetch ahead distance. + For example, in a loop with a prefetch ahead distance of 10, + supposing that TRIP_COUNT_TO_AHEAD_RATIO is equal to 4, it is + profitable to prefetch when the trip count is greater or equal to + 40. In that case, 30 out of the 40 iterations will benefit from + prefetching. */ + +#ifndef TRIP_COUNT_TO_AHEAD_RATIO +#define TRIP_COUNT_TO_AHEAD_RATIO 4 +#endif + /* The group of references between that reuse may occur. */ struct mem_ref_group @@ -1585,7 +1597,7 @@ is_loop_prefetching_profitable (unsigned ahead, HOST_WIDE_INT est_niter, return insn_to_prefetch_ratio >= MIN_INSN_TO_PREFETCH_RATIO; } - if (est_niter <= (HOST_WIDE_INT) ahead) + if (est_niter < (HOST_WIDE_INT) (TRIP_COUNT_TO_AHEAD_RATIO * ahead)) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, |