This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Properly check result of compute_all_dependences in prefetching


This is the last caller of compute_all_dependences that does
not check its return value.

Currently bootstrapping and testing on x86_64-unknown-linux-gnu.

Richard.

2012-05-04  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-loop-prefetch.c (determine_loop_nest_reuse): Return
	whether we failed to compute data dependences.
	(loop_prefetch_arrays): Fail if we failed.

Index: gcc/tree-ssa-loop-prefetch.c
===================================================================
*** gcc/tree-ssa-loop-prefetch.c	(revision 187152)
--- gcc/tree-ssa-loop-prefetch.c	(working copy)
*************** self_reuse_distance (data_reference_p dr
*** 1495,1503 ****
  
  /* Determines the distance till the first reuse of each reference in REFS
     in the loop nest of LOOP.  NO_OTHER_REFS is true if there are no other
!    memory references in the loop.  */
  
! static void
  determine_loop_nest_reuse (struct loop *loop, struct mem_ref_group *refs,
  			   bool no_other_refs)
  {
--- 1495,1503 ----
  
  /* Determines the distance till the first reuse of each reference in REFS
     in the loop nest of LOOP.  NO_OTHER_REFS is true if there are no other
!    memory references in the loop.  Return false if the analysis fails.  */
  
! static bool
  determine_loop_nest_reuse (struct loop *loop, struct mem_ref_group *refs,
  			   bool no_other_refs)
  {
*************** determine_loop_nest_reuse (struct loop *
*** 1515,1521 ****
    ddr_p dep;
  
    if (loop->inner)
!     return;
  
    /* Find the outermost loop of the loop nest of loop (we require that
       there are no sibling loops inside the nest).  */
--- 1515,1521 ----
    ddr_p dep;
  
    if (loop->inner)
!     return true;
  
    /* Find the outermost loop of the loop nest of loop (we require that
       there are no sibling loops inside the nest).  */
*************** determine_loop_nest_reuse (struct loop *
*** 1585,1591 ****
  	ref->independent_p = true;
      }
  
!   compute_all_dependences (datarefs, &dependences, vloops, true);
  
    FOR_EACH_VEC_ELT (ddr_p, dependences, i, dep)
      {
--- 1585,1592 ----
  	ref->independent_p = true;
      }
  
!   if (!compute_all_dependences (datarefs, &dependences, vloops, true))
!     return false;
  
    FOR_EACH_VEC_ELT (ddr_p, dependences, i, dep)
      {
*************** determine_loop_nest_reuse (struct loop *
*** 1664,1669 ****
--- 1665,1672 ----
  	  fprintf (dump_file, " ref %p distance %u\n",
  		   (void *) ref, ref->reuse_distance);
      }
+ 
+   return true;
  }
  
  /* Determine whether or not the trip count to ahead ratio is too small based
*************** loop_prefetch_arrays (struct loop *loop)
*** 1826,1832 ****
    if (nothing_to_prefetch_p (refs))
      goto fail;
  
!   determine_loop_nest_reuse (loop, refs, no_other_refs);
  
    /* Step 3: determine unroll factor.  */
    unroll_factor = determine_unroll_factor (loop, refs, ninsns, &desc,
--- 1829,1836 ----
    if (nothing_to_prefetch_p (refs))
      goto fail;
  
!   if (!determine_loop_nest_reuse (loop, refs, no_other_refs))
!     goto fail;
  
    /* Step 3: determine unroll factor.  */
    unroll_factor = determine_unroll_factor (loop, refs, ninsns, &desc,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]