diff mbox

Use likely upper bound in array prefetching

Message ID 20160528162512.GB40465@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka May 28, 2016, 4:25 p.m. UTC
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.
diff mbox

Patch

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.  */