OSDN Git Service

Fix nit
[pf3gnuchains/gcc-fork.git] / gcc / tree-parloops.c
index 56b88a8..885a713 100644 (file)
@@ -862,13 +862,12 @@ create_call_for_reduction_1 (void **slot, void *data)
   basic_block bb;
   basic_block new_bb;
   edge e;
-  tree t, addr, addr_type, ref, x;
+  tree t, addr, ref, x;
   tree tmp_load, name;
   gimple load;
 
   load_struct = fold_build1 (INDIRECT_REF, struct_type, clsn_data->load);
   t = build3 (COMPONENT_REF, type, load_struct, reduc->field, NULL_TREE);
-  addr_type = build_pointer_type (type);
 
   addr = build_addr (t, current_function_decl);
 
@@ -1330,7 +1329,6 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit
 
   for (n = 0; bbs[n] != loop->latch; n++)
     continue;
-  n--;
   nbbs = XNEWVEC (basic_block, n);
   ok = gimple_duplicate_sese_tail (single_succ_edge (loop->header), exit,
                                   bbs + 1, n, nbbs);
@@ -1405,7 +1403,7 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
 {
   gimple_stmt_iterator gsi;
   basic_block bb, paral_bb, for_bb, ex_bb;
-  tree t, param, res;
+  tree t, param;
   gimple stmt, for_stmt, phi, cond_stmt;
   tree cvar, cvar_init, initvar, cvar_next, cvar_base, type;
   edge exit, nexit, guard, end, e;
@@ -1474,7 +1472,6 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
       source_location locus;
       tree def;
       phi = gsi_stmt (gsi);
-      res = PHI_RESULT (phi);
       stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit));
 
       def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop));
@@ -1531,7 +1528,6 @@ static void
 gen_parallel_loop (struct loop *loop, htab_t reduction_list,
                   unsigned n_threads, struct tree_niter_desc *niter)
 {
-  struct loop *nloop;
   loop_iterator li;
   tree many_iterations_cond, type, nit;
   tree arg_struct, new_arg_struct;
@@ -1624,8 +1620,8 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list,
 
   /* We assume that the loop usually iterates a lot.  */
   prob = 4 * REG_BR_PROB_BASE / 5;
-  nloop = loop_version (loop, many_iterations_cond, NULL,
-                       prob, prob, REG_BR_PROB_BASE - prob, true);
+  loop_version (loop, many_iterations_cond, NULL,
+               prob, prob, REG_BR_PROB_BASE - prob, true);
   update_ssa (TODO_update_ssa);
   free_original_copy_tables ();
 
@@ -1887,10 +1883,14 @@ parallelize_loops (void)
   struct tree_niter_desc niter_desc;
   loop_iterator li;
   htab_t reduction_list;
-
+  HOST_WIDE_INT estimated;
+  LOC loop_loc;
+  
   /* Do not parallelize loops in the functions created by parallelization.  */
   if (parallelized_function_p (cfun->decl))
     return false;
+  if (cfun->has_nonlocal_label)
+    return false;
 
   reduction_list = htab_create (10, reduction_info_hash,
                                     reduction_info_eq, free);
@@ -1929,15 +1929,16 @@ parallelize_loops (void)
       if (/* And of course, the loop must be parallelizable.  */
          !can_duplicate_loop_p (loop)
          || loop_has_blocks_with_irreducible_flag (loop)
+         || (loop_preheader_edge (loop)->src->flags & BB_IRREDUCIBLE_LOOP)
          /* FIXME: the check for vector phi nodes could be removed.  */
          || loop_has_vector_phi_nodes (loop))
        continue;
-
+      estimated = estimated_loop_iterations_int (loop, false);
       /* FIXME: Bypass this check as graphite doesn't update the
       count and frequency correctly now.  */
       if (!flag_loop_parallelize_all
-         && ((estimated_loop_iterations_int (loop, false)
-              <= (HOST_WIDE_INT) n_threads * MIN_PER_THREAD)
+         && ((estimated !=-1 
+            && estimated <= (HOST_WIDE_INT) n_threads * MIN_PER_THREAD)
              /* Do not bother with loops in cold areas.  */
              || optimize_loop_nest_for_size_p (loop)))
        continue;
@@ -1954,11 +1955,14 @@ parallelize_loops (void)
       changed = true;
       if (dump_file && (dump_flags & TDF_DETAILS))
       {
-        fprintf (dump_file, "parallelizing ");
        if (loop->inner)
-         fprintf (dump_file, "outer loop\n");
+         fprintf (dump_file, "parallelizing outer loop %d\n",loop->header->index);
        else
-         fprintf (dump_file, "inner loop\n");
+         fprintf (dump_file, "parallelizing inner loop %d\n",loop->header->index);
+       loop_loc = find_loop_location (loop);
+       if (loop_loc != UNKNOWN_LOC)
+         fprintf (dump_file, "\nloop at %s:%d: ",
+                  LOC_FILE (loop_loc), LOC_LINE (loop_loc));
       }
       gen_parallel_loop (loop, reduction_list,
                         n_threads, &niter_desc);