]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/tree-ssa-loop-prefetch.c
Merge from trunk.
[thirdparty/gcc.git] / gcc / tree-ssa-loop-prefetch.c
index 0939541746e68719c1149f7984aaf2d0491ee94b..32b9f8c216f71a6f3dbd18a37b927cc4c9cf9e41 100644 (file)
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "stor-layout.h"
 #include "tm_p.h"
 #include "basic-block.h"
 #include "tree-pretty-print.h"
@@ -294,7 +295,7 @@ dump_mem_details (FILE *file, tree base, tree step,
   fprintf (file, "(base ");
   print_generic_expr (file, base, TDF_SLIM);
   fprintf (file, ", step ");
-  if (cst_and_fits_in_hwi (step))
+  if (cst_fits_shwi_p (step))
     fprintf (file, HOST_WIDE_INT_PRINT_DEC, int_cst_value (step));
   else
     print_generic_expr (file, step, TDF_TREE);
@@ -335,7 +336,7 @@ find_or_create_group (struct mem_ref_group **groups, tree base, tree step)
 
       /* If step is an integer constant, keep the list of groups sorted
          by decreasing step.  */
-        if (cst_and_fits_in_hwi ((*groups)->step) && cst_and_fits_in_hwi (step)
+        if (cst_fits_shwi_p ((*groups)->step) && cst_fits_shwi_p (step)
             && int_cst_value ((*groups)->step) < int_cst_value (step))
        break;
     }
@@ -443,12 +444,12 @@ idx_analyze_ref (tree base, tree *index, void *data)
   step = iv.step;
 
   if (TREE_CODE (ibase) == POINTER_PLUS_EXPR
-      && cst_and_fits_in_hwi (TREE_OPERAND (ibase, 1)))
+      && cst_fits_shwi_p (TREE_OPERAND (ibase, 1)))
     {
       idelta = int_cst_value (TREE_OPERAND (ibase, 1));
       ibase = TREE_OPERAND (ibase, 0);
     }
-  if (cst_and_fits_in_hwi (ibase))
+  if (cst_fits_shwi_p (ibase))
     {
       idelta += int_cst_value (ibase);
       ibase = build_int_cst (TREE_TYPE (ibase), 0);
@@ -457,7 +458,7 @@ idx_analyze_ref (tree base, tree *index, void *data)
   if (TREE_CODE (base) == ARRAY_REF)
     {
       stepsize = array_ref_element_size (base);
-      if (!cst_and_fits_in_hwi (stepsize))
+      if (!cst_fits_shwi_p (stepsize))
        return false;
       imult = int_cst_value (stepsize);
       step = fold_build2 (MULT_EXPR, sizetype,
@@ -555,7 +556,7 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
 
   /* Limit non-constant step prefetching only to the innermost loops and 
      only when the step is loop invariant in the entire loop nest. */
-  if (!cst_and_fits_in_hwi (step))
+  if (!cst_fits_shwi_p (step))
     {
       if (loop->inner != NULL)
         {
@@ -669,7 +670,7 @@ prune_ref_by_self_reuse (struct mem_ref *ref)
   bool backward;
 
   /* If the step size is non constant, we cannot calculate prefetch_mod.  */
-  if (!cst_and_fits_in_hwi (ref->group->step))
+  if (!cst_fits_shwi_p (ref->group->step))
     return;
 
   step = int_cst_value (ref->group->step);
@@ -779,7 +780,7 @@ prune_ref_by_group_reuse (struct mem_ref *ref, struct mem_ref *by,
   int align_unit;
 
   /* If the step is non constant we cannot calculate prefetch_before.  */
-  if (!cst_and_fits_in_hwi (ref->group->step)) {
+  if (!cst_fits_shwi_p (ref->group->step)) {
     return;
   }
 
@@ -1144,7 +1145,7 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
 
   for (ap = 0; ap < n_prefetches; ap++)
     {
-      if (cst_and_fits_in_hwi (ref->group->step))
+      if (cst_fits_shwi_p (ref->group->step))
         {
           /* Determine the address to prefetch.  */
           delta = (ahead + ap * ref->prefetch_mod) *
@@ -1281,7 +1282,7 @@ may_use_storent_in_loop_p (struct loop *loop)
 
       FOR_EACH_VEC_ELT (exits, i, exit)
        if ((exit->flags & EDGE_ABNORMAL)
-           && exit->dest == EXIT_BLOCK_PTR)
+           && exit->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
          ret = false;
 
       exits.release ();
@@ -1458,8 +1459,8 @@ add_subscript_strides (tree access_fn, unsigned stride,
       if ((unsigned) loop_depth (aloop) <= min_depth)
        continue;
 
-      if (host_integerp (step, 0))
-       astep = tree_low_cst (step, 0);
+      if (tree_fits_shwi_p (step))
+       astep = tree_to_shwi (step);
       else
        astep = L1_CACHE_LINE_SIZE;
 
@@ -1508,8 +1509,8 @@ self_reuse_distance (data_reference_p dr, unsigned *loop_sizes, unsigned n,
       if (TREE_CODE (ref) == ARRAY_REF)
        {
          stride = TYPE_SIZE_UNIT (TREE_TYPE (ref));
-         if (host_integerp (stride, 1))
-           astride = tree_low_cst (stride, 1);
+         if (tree_fits_uhwi_p (stride))
+           astride = tree_to_uhwi (stride);
          else
            astride = L1_CACHE_LINE_SIZE;
 
@@ -1929,7 +1930,6 @@ fail:
 unsigned int
 tree_ssa_prefetch_arrays (void)
 {
-  loop_iterator li;
   struct loop *loop;
   bool unrolled = false;
   int todo_flags = 0;
@@ -1977,7 +1977,7 @@ tree_ssa_prefetch_arrays (void)
      here.  */
   gcc_assert ((PREFETCH_BLOCK & (PREFETCH_BLOCK - 1)) == 0);
 
-  FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST)
+  FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
     {
       if (dump_file && (dump_flags & TDF_DETAILS))
        fprintf (dump_file, "Processing loop %d:\n", loop->num);