This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Use likely upper bound in array prefetching
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 28 May 2016 18:25:12 +0200
- Subject: Use likely upper bound in array prefetching
- Authentication-results: sourceware.org; auth=none
Hi,
this patch makes array prefetching to use likely upper bound on number of
iterations. This restores the behaviour on prefetch-5.c testcase.
Honza
* gcc.dg/tree-ssa/prefetch-5.c: Remove xfail.
* tree-ssa-loop-prefetch.c (loop_prefetch_arrays): Use
likely_max_stmt_executions_int.
Index: testsuite/gcc.dg/tree-ssa/prefetch-5.c
===================================================================
--- testsuite/gcc.dg/tree-ssa/prefetch-5.c (revision 236815)
+++ testsuite/gcc.dg/tree-ssa/prefetch-5.c (working copy)
@@ -56,5 +56,5 @@ int loop5 (int n, struct tail5 *x)
/* Until we are able to track likely upper bounds, we can't really work out that
small trailing arrays should not be prefetched. */
-/* { dg-final { scan-tree-dump-times "Issued prefetch" 2 "aprefetch" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "Not prefetching" 1 "aprefetch" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Issued prefetch" 2 "aprefetch" } } */
+/* { dg-final { scan-tree-dump-times "Not prefetching" 1 "aprefetch" } } */
Index: tree-ssa-loop-prefetch.c
===================================================================
--- tree-ssa-loop-prefetch.c (revision 236815)
+++ tree-ssa-loop-prefetch.c (working copy)
@@ -1848,7 +1848,7 @@ loop_prefetch_arrays (struct loop *loop)
ahead = (PREFETCH_LATENCY + time - 1) / time;
est_niter = estimated_stmt_executions_int (loop);
if (est_niter == -1)
- est_niter = max_stmt_executions_int (loop);
+ est_niter = likely_max_stmt_executions_int (loop);
/* Prefetching is not likely to be profitable if the trip count to ahead
ratio is too small. */