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]

Re: [autovect] [patch] Identify unknown evolution and skip invariant phis.


Ira Rosen wrote:
> 
> 
> 
> 
> This patch adds a new boolean parameter, DONT_KNOW, to
> analyze_scalar_evolution function to distinguish between unknown and NULL
> evolution (until now, in both cases scev analyzer returned evolution =
> NULL). If the evolution is unknown, DONT_KNOW is set to TRUE.
> With this parameter, we are also able to recognize, when a combination of
> two access functions is incorrect. It happened when one of the combined
> access function had an unknown evolution. E.g., '{0, +, 1}' and 'D' (here
> the evolution is unknown), are combined into {D, +, 1}. Now, scev analyzer
> also sets the returned flag 'unknown_evolution' to true in such case.
> Testcase attached.
> 
> In addition, we are able now to identify invariant phi nodes and safely
> ignore them in the vectorizer.
> 
> Bootstrapped and tested on ppc-darwin. Committed to autovect branch.
> 
> Ira
> 
> ChangeLog entry:
> 
>       * lambda-code.c (gcc_loop_to_lambda_loop): Call
> analyze_scalar_evolution
>       with correct parameters.
>       * tree-data-ref.c (analyze_array_indexes): Likewise.
>       (analyze_indirect_ref): Likewise and check if the reference is loop
>       invariant with the help of the new parameter of
> analyze_scalar_evolution.
>       (analyze_offset_expr): Likewise.
>       * tree-elim-check.c (try_eliminate_check): Call
>       analyze_scalar_evolution with correct parameters.
>       * tree-scalar-evolution.c (follow_ssa_edge_inner_loop_phi,
>       unify_peeled_chrec, interpret_loop_phi, interpret_condition_phi,
>       interpret_rhs_modify_expr): Likewise.
>       (compute_scalar_evolution_in_loop): Call
>       analyze_scalar_evolution_1 with correct parameters.
>       (analyze_scalar_evolution_1): Add parameters to always analyze
> evolution
>       and to decide whether it is unknown. Fix parameters of
>       interpret_rhs_modify_expr and analyze_scalar_evolution_1.
>       (analyze_scalar_evolution): Add parameters to always analyze
> evolution
>       and to decide whether it is unknown. Fix parameters of
>       analyze_scalar_evolution_1.
>       (instantiate_parameters_1): Call analyze_scalar_evolution with
> correct
>       parameters.
>       (analyze_scalar_evolution_for_all_loop_phi_nodes): Likewise.
>       * tree-scalar-evolution.h (analyze_scalar_evolution): Add parameters
> to
>       the declaration.
>       * tree-vect-analyze.c (vect_analyze_scalar_cycles): Call
>       analyze_scalar_evolution with correct parameters. Skip invariant phis
>       with the help of unknown_evolution.
>       (vect_can_advance_ivs_p): Likewise.
>       * tree-vect-transform.c (vect_get_vec_def_for_operand): Handle
> invariant
>       phis.
>       (vect_update_ivs_after_vectorizer):  Call analyze_scalar_evolution
> with
>       correct parameters. If no evolution, it must be an unknown evolution.
>       * tree-vectorizer.h (enum vect_def_type): Add vect_invariant_phi_def.
> 
> Patch:
> (See attached file: scev.patch)
> Test:
> (See attached file: vect-117.c)

As I think that we ended to agree in an offlist discussion, this patch
is no longer needed after Danny has fixed PRE to not produce invariant
phi nodes.  

Thus, I have reverted this patch.  I've kept the testcase vect-117.c,
but it still produces warnings on 64bit machines, so it fails with
excess errors:

/home/seb/av/gcc/gcc/testsuite/gcc.dg/vect/no_version/vect-117.c:19: warning: cast to pointer from
 integer of different size
/home/seb/av/gcc/gcc/testsuite/gcc.dg/vect/no_version/vect-117.c:25: warning: cast to pointer from
 integer of different size

I've bootstrapped and tested the attached patch on amd64-linux, C
language only.

Sebastian

? pip.c
? pip.h
Index: ChangeLog.autovect
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.autovect,v
retrieving revision 1.1.2.79
diff -d -u -p -r1.1.2.79 ChangeLog.autovect
--- ChangeLog.autovect	1 Aug 2005 16:50:47 -0000	1.1.2.79
+++ ChangeLog.autovect	15 Aug 2005 17:40:03 -0000
@@ -1,3 +1,7 @@
+2005-08-15  Sebastian Pop  <pop@cri.ensmp.fr>
+
+	Reverted 2005-07-05  Ira Rosen  <irar@il.ibm.com>.
+
 2005-08-01  Sebastian Pop  <pop@cri.ensmp.fr>
 
 	* common.opt: Add -fcheck-data-deps.
Index: lambda-code.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/lambda-code.c,v
retrieving revision 2.18.2.6
diff -d -u -p -r2.18.2.6 lambda-code.c
--- lambda-code.c	1 Aug 2005 16:50:48 -0000	2.18.2.6
+++ lambda-code.c	15 Aug 2005 17:40:05 -0000
@@ -1227,7 +1227,6 @@ gcc_loop_to_lambda_loop (struct loop *lo
   int extra = 0;
   tree lboundvar, uboundvar, uboundresult;
   use_optype uses;
-  bool unknown_evolution;
 
   /* Find out induction var and exit condition.  */
   inductionvar = find_induction_var_from_exit_cond (loop);
@@ -1286,7 +1285,7 @@ gcc_loop_to_lambda_loop (struct loop *lo
      result of the induction variable phi node.  */
   *ourinductionvar = PHI_RESULT (phi);
   access_fn = instantiate_parameters
-    (loop, analyze_scalar_evolution (loop, PHI_RESULT (phi), false, &unknown_evolution));
+    (loop, analyze_scalar_evolution (loop, PHI_RESULT (phi)));
   if (access_fn == chrec_dont_know)
     {
       if (dump_file && (dump_flags & TDF_DETAILS))
Index: tree-data-ref.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.c,v
retrieving revision 2.15.4.32
diff -d -u -p -r2.15.4.32 tree-data-ref.c
--- tree-data-ref.c	1 Aug 2005 16:50:48 -0000	2.15.4.32
+++ tree-data-ref.c	15 Aug 2005 17:40:08 -0000
@@ -858,7 +858,6 @@ analyze_array_indexes (struct loop *loop
 {
   tree opnd0, opnd1;
   tree access_fn;
-  bool unknown_evolution;
   
   opnd0 = TREE_OPERAND (ref, 0);
   opnd1 = TREE_OPERAND (ref, 1);
@@ -868,7 +867,7 @@ analyze_array_indexes (struct loop *loop
      the computation of access functions that are of no interest for
      the optimizers.  */
   access_fn = instantiate_parameters 
-    (loop, analyze_scalar_evolution (loop, opnd1, false, &unknown_evolution));
+    (loop, analyze_scalar_evolution (loop, opnd1));
 
   if (loop->estimated_nb_iterations == NULL_TREE)
     estimate_niter_from_size_of_data (loop, opnd0, access_fn, stmt);
@@ -936,9 +935,7 @@ analyze_indirect_ref (tree stmt, tree re
 {
   struct loop *loop = loop_containing_stmt (stmt);
   tree ptr_ref = TREE_OPERAND (ref, 0);
-  bool unknown_evolution;
-  tree access_fn = analyze_scalar_evolution (loop, ptr_ref, true, 
-					     &unknown_evolution);
+  tree access_fn = analyze_scalar_evolution (loop, ptr_ref);
   tree init = initial_condition_in_loop_num (access_fn, loop->num);
   tree base_address = NULL_TREE, evolution, step = NULL_TREE;
   struct ptr_info_def *pointsto_info = NULL;
@@ -965,11 +962,11 @@ analyze_indirect_ref (tree stmt, tree re
       fprintf (dump_file, "\n");
     }
 
-  if (unknown_evolution)
+  if (!expr_invariant_in_loop_p (loop, init))
     {
-      if (dump_file && (dump_flags & TDF_DETAILS))
-	fprintf (dump_file, "\nunknown evolution of ptr.\n");
-    }  
+    if (dump_file && (dump_flags & TDF_DETAILS))
+	fprintf (dump_file, "\ninitial condition is not loop invariant.\n");	
+    }
   else
     {
       base_address = init;
@@ -1123,7 +1120,6 @@ analyze_offset_expr (tree expr, 
   tree right_step = ssize_int (0);
   enum tree_code code;
   tree init, evolution;
-  bool unknown_evolution;
 
   *step = NULL_TREE;
   *misalign = NULL_TREE;
@@ -1148,15 +1144,14 @@ analyze_offset_expr (tree expr, 
      access_fn in the current loop.  */
   if (SSA_VAR_P (expr))
     {
-      tree access_fn = analyze_scalar_evolution (loop, expr, true, 
-						 &unknown_evolution);
+      tree access_fn = analyze_scalar_evolution (loop, expr);
 
       if (access_fn == chrec_dont_know)
 	/* No access_fn.  */
 	return false;
 
       init = initial_condition_in_loop_num (access_fn, loop->num);
-      if (init == expr && unknown_evolution)
+      if (init == expr && !expr_invariant_in_loop_p (loop, init))
 	/* Not enough information: may be not loop invariant.  
 	   E.g., for a[b[i]], we get a[D], where D=b[i]. EXPR is D, its 
 	   initial_condition is D, but it depends on i - loop's induction
Index: tree-elim-check.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-elim-check.c,v
retrieving revision 1.1.6.3
diff -d -u -p -r1.1.6.3 tree-elim-check.c
--- tree-elim-check.c	5 Jul 2005 12:05:49 -0000	1.1.6.3
+++ tree-elim-check.c	15 Aug 2005 17:40:08 -0000
@@ -383,7 +383,6 @@ try_eliminate_check (tree cond)
   struct loop *loop = loop_containing_stmt (cond);
   tree nb_iters = number_of_iterations_in_loop (loop);
   enum tree_code code;
-  bool unknown_evolution;
 
   if (chrec_contains_undetermined (nb_iters))
     return;
@@ -404,7 +403,7 @@ try_eliminate_check (tree cond)
       /* Matched "if (opnd0)" ie, "if (opnd0 != 0)".  */
       opnd0 = test;
       chrec0 = instantiate_parameters 
-	(loop, analyze_scalar_evolution (loop, opnd0, false, &unknown_evolution));
+	(loop, analyze_scalar_evolution (loop, opnd0));
       if (chrec_contains_undetermined (chrec0))
 	goto end;
 
@@ -422,9 +421,9 @@ try_eliminate_check (tree cond)
       opnd1 = TREE_OPERAND (test, 1);
 
       chrec0 = instantiate_parameters 
-	(loop, analyze_scalar_evolution (loop, opnd0, false, &unknown_evolution));
+	(loop, analyze_scalar_evolution (loop, opnd0));
       chrec1 = instantiate_parameters 
-	(loop, analyze_scalar_evolution (loop, opnd1, false, &unknown_evolution));
+	(loop, analyze_scalar_evolution (loop, opnd1));
 
       if (chrec_contains_undetermined (chrec0)
 	  || chrec_contains_undetermined (chrec1))
Index: tree-scalar-evolution.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-scalar-evolution.c,v
retrieving revision 2.10.2.7
diff -d -u -p -r2.10.2.7 tree-scalar-evolution.c
--- tree-scalar-evolution.c	5 Jul 2005 12:05:49 -0000	2.10.2.7
+++ tree-scalar-evolution.c	15 Aug 2005 17:40:08 -0000
@@ -252,7 +252,7 @@ Software Foundation, 59 Temple Place - S
 #include "tree-pass.h"
 #include "flags.h"
 
-static tree analyze_scalar_evolution_1 (struct loop *, tree, tree, bool, bool*);
+static tree analyze_scalar_evolution_1 (struct loop *, tree, tree);
 static tree resolve_mixers (struct loop *, tree);
 
 /* The cached information about a ssa name VAR, claiming that inside LOOP,
@@ -1361,9 +1361,7 @@ follow_ssa_edge_inner_loop_phi (struct l
 				tree *evolution_of_loop)
 {
   struct loop *loop = loop_containing_stmt (loop_phi_node);
-  bool dont_know;
-  tree ev = analyze_scalar_evolution (loop, PHI_RESULT (loop_phi_node), 
-				      false, &dont_know);
+  tree ev = analyze_scalar_evolution (loop, PHI_RESULT (loop_phi_node));
 
   /* Sometimes, the inner loop is too difficult to analyze, and the
      result of the analysis is a symbolic parameter.  */
@@ -1473,7 +1471,6 @@ unify_peeled_chrec (tree loop_phi_node, 
 {
   tree chrec_b, extrapolate, difference, type;
   struct loop *loop = loop_containing_stmt (loop_phi_node);
-  bool dont_know;
 
   if (a == NULL_TREE 
       || b == NULL_TREE || TREE_CODE (b) != SSA_NAME
@@ -1488,8 +1485,7 @@ unify_peeled_chrec (tree loop_phi_node, 
 	return chrec_dont_know;
 
       bitmap_set_bit (already_unified, SSA_NAME_VERSION (a));
-      chrec_a = instantiate_parameters (loop, analyze_scalar_evolution (loop, a,
-							    false, &dont_know));
+      chrec_a = instantiate_parameters (loop, analyze_scalar_evolution (loop, a));
       bitmap_clear_bit (already_unified, SSA_NAME_VERSION (a));
       a = chrec_a;
     }
@@ -1499,8 +1495,7 @@ unify_peeled_chrec (tree loop_phi_node, 
     return chrec_dont_know;
 
   bitmap_set_bit (already_unified, SSA_NAME_VERSION (b));
-  chrec_b = instantiate_parameters (loop, analyze_scalar_evolution (loop, b, 
-							false, &dont_know));
+  chrec_b = instantiate_parameters (loop, analyze_scalar_evolution (loop, b));
   bitmap_clear_bit (already_unified, SSA_NAME_VERSION (b));
   
   if (chrec_b == NULL_TREE 
@@ -1705,13 +1700,12 @@ interpret_loop_phi (struct loop *loop, t
   tree res;
   struct loop *phi_loop = loop_containing_stmt (loop_phi_node);
   tree init_cond;
-  bool dont_know;
   
   if (phi_loop != loop)
     {
       struct loop *subloop;
       tree evolution_fn = analyze_scalar_evolution
-	(phi_loop, PHI_RESULT (loop_phi_node), false, &dont_know);
+	(phi_loop, PHI_RESULT (loop_phi_node));
 
       /* Dive one level deeper.  */
       subloop = superloop_at_depth (phi_loop, loop->depth + 1);
@@ -1737,7 +1731,6 @@ interpret_condition_phi (struct loop *lo
 {
   int i;
   tree res = chrec_not_analyzed_yet;
-  bool dont_know;
   
   for (i = 0; i < PHI_NUM_ARGS (condition_phi); i++)
     {
@@ -1750,7 +1743,7 @@ interpret_condition_phi (struct loop *lo
 	}
 
       branch_chrec = analyze_scalar_evolution
-	(loop, PHI_ARG_DEF (condition_phi, i), false, &dont_know);
+	(loop, PHI_ARG_DEF (condition_phi, i));
       
       res = chrec_merge (res, branch_chrec);
     }
@@ -1767,11 +1760,9 @@ interpret_condition_phi (struct loop *lo
 
 static tree
 interpret_rhs_modify_expr (struct loop *loop,
-			   tree opnd1, tree type,
-			   bool analyze, bool *dont_know)
+			   tree opnd1, tree type)
 {
   tree res, opnd10, opnd11, chrec10, chrec11;
-  bool dont_know10, dont_know11;
   
   if (is_gimple_min_invariant (opnd1))
     return chrec_convert (type, opnd1);
@@ -1781,28 +1772,26 @@ interpret_rhs_modify_expr (struct loop *
     case PLUS_EXPR:
       opnd10 = TREE_OPERAND (opnd1, 0);
       opnd11 = TREE_OPERAND (opnd1, 1);
-      chrec10 = analyze_scalar_evolution (loop, opnd10, analyze, &dont_know10);
-      chrec11 = analyze_scalar_evolution (loop, opnd11, analyze, &dont_know11);
+      chrec10 = analyze_scalar_evolution (loop, opnd10);
+      chrec11 = analyze_scalar_evolution (loop, opnd11);
       chrec10 = chrec_convert (type, chrec10);
       chrec11 = chrec_convert (type, chrec11);
       res = chrec_fold_plus (type, chrec10, chrec11);
-      *dont_know = dont_know10 || dont_know11;
       break;
       
     case MINUS_EXPR:
       opnd10 = TREE_OPERAND (opnd1, 0);
       opnd11 = TREE_OPERAND (opnd1, 1);
-      chrec10 = analyze_scalar_evolution (loop, opnd10, analyze, &dont_know10);
-      chrec11 = analyze_scalar_evolution (loop, opnd11, analyze, &dont_know11);
+      chrec10 = analyze_scalar_evolution (loop, opnd10);
+      chrec11 = analyze_scalar_evolution (loop, opnd11);
       chrec10 = chrec_convert (type, chrec10);
       chrec11 = chrec_convert (type, chrec11);
       res = chrec_fold_minus (type, chrec10, chrec11);
-      *dont_know = dont_know10 || dont_know11;
       break;
 
     case NEGATE_EXPR:
       opnd10 = TREE_OPERAND (opnd1, 0);
-      chrec10 = analyze_scalar_evolution (loop, opnd10, analyze, dont_know);
+      chrec10 = analyze_scalar_evolution (loop, opnd10);
       chrec10 = chrec_convert (type, chrec10);
       res = chrec_fold_minus (type, build_int_cst (type, 0), chrec10);
       break;
@@ -1810,29 +1799,26 @@ interpret_rhs_modify_expr (struct loop *
     case MULT_EXPR:
       opnd10 = TREE_OPERAND (opnd1, 0);
       opnd11 = TREE_OPERAND (opnd1, 1);
-      chrec10 = analyze_scalar_evolution (loop, opnd10, analyze, &dont_know10);
-      chrec11 = analyze_scalar_evolution (loop, opnd11, analyze, &dont_know11);
+      chrec10 = analyze_scalar_evolution (loop, opnd10);
+      chrec11 = analyze_scalar_evolution (loop, opnd11);
       chrec10 = chrec_convert (type, chrec10);
       chrec11 = chrec_convert (type, chrec11);
       res = chrec_fold_multiply (type, chrec10, chrec11);
-      *dont_know = dont_know10 || dont_know11;
       break;
       
     case SSA_NAME:
-      res = chrec_convert (type, analyze_scalar_evolution (loop, opnd1, analyze,
-							   dont_know));
+      res = chrec_convert (type, analyze_scalar_evolution (loop, opnd1));
       break;
       
     case NOP_EXPR:
     case CONVERT_EXPR:
       opnd10 = TREE_OPERAND (opnd1, 0);
-      chrec10 = analyze_scalar_evolution (loop, opnd10, analyze, dont_know);
+      chrec10 = analyze_scalar_evolution (loop, opnd10);
       res = chrec_convert (type, chrec10);
       break;
       
     default:
       res = chrec_dont_know;
-      *dont_know = true;
       break;
     }
   
@@ -1856,32 +1842,19 @@ compute_scalar_evolution_in_loop (struct
 				  tree ev)
 {
   tree res;
-  bool dont_know;
-
   if (def_loop == wrto_loop)
     return ev;
 
   def_loop = superloop_at_depth (def_loop, wrto_loop->depth + 1);
   res = compute_overall_effect_of_inner_loop (def_loop, ev);
 
-  return analyze_scalar_evolution_1 (wrto_loop, res, chrec_not_analyzed_yet, 
-    false, &dont_know);
+  return analyze_scalar_evolution_1 (wrto_loop, res, chrec_not_analyzed_yet);
 }
 
 /* Helper recursive function.  */
 
-/*
-   If ANALYZE is TRUE, evolution is analyzed even if it was done before
-   and the result is stored in the database.
-           
-   If the evolution of VAR is unknown, DONT_KNOW is set to TRUE. The 
-   evolution part of the returned access function is NULL in such cases. 
-   (It is also NULL, when VAR is loop invariant, but in this case DONT_KNOW 
-   is set to FALSE).
-*/
 static tree
-analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res, 
-			    bool analyze, bool *dont_know)
+analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res)
 {
   tree def, type = TREE_TYPE (var);
   basic_block bb;
@@ -1891,7 +1864,7 @@ analyze_scalar_evolution_1 (struct loop 
     return chrec_dont_know;
 
   if (TREE_CODE (var) != SSA_NAME)
-    return interpret_rhs_modify_expr (loop, var, type, analyze, dont_know);
+    return interpret_rhs_modify_expr (loop, var, type);
 
   def = SSA_NAME_DEF_STMT (var);
   bb = bb_for_stmt (def);
@@ -1905,7 +1878,7 @@ analyze_scalar_evolution_1 (struct loop 
       goto set_and_end;
     }
 
-  if (res != chrec_not_analyzed_yet && !analyze)
+  if (res != chrec_not_analyzed_yet)
     {
       if (loop != bb->loop_father)
 	res = compute_scalar_evolution_in_loop 
@@ -1916,8 +1889,7 @@ analyze_scalar_evolution_1 (struct loop 
 
   if (loop != def_loop)
     {
-      res = analyze_scalar_evolution_1 (def_loop, var, chrec_not_analyzed_yet,
-					analyze, dont_know);
+      res = analyze_scalar_evolution_1 (def_loop, var, chrec_not_analyzed_yet);
       res = compute_scalar_evolution_in_loop (loop, def_loop, res);
 
       goto set_and_end;
@@ -1926,8 +1898,7 @@ analyze_scalar_evolution_1 (struct loop 
   switch (TREE_CODE (def))
     {
     case MODIFY_EXPR:
-      res = interpret_rhs_modify_expr (loop, TREE_OPERAND (def, 1), type, 
-				       analyze, dont_know);
+      res = interpret_rhs_modify_expr (loop, TREE_OPERAND (def, 1), type);
       break;
 
     case PHI_NODE:
@@ -1946,10 +1917,7 @@ analyze_scalar_evolution_1 (struct loop 
 
   /* Keep the symbolic form.  */
   if (res == chrec_dont_know)
-    {
-      *dont_know = true;
-      res = var;
-    }
+    res = var;
 
   if (loop == def_loop)
     set_scalar_evolution (var, res);
@@ -1971,19 +1939,10 @@ analyze_scalar_evolution_1 (struct loop 
    tree chrec_with_symbols = analyze_scalar_evolution (loop_nb, var);
    tree chrec_instantiated = instantiate_parameters 
    (loop_nb, chrec_with_symbols);
-
-   If ANALYZE is TRUE, evolution is analyzed even if it was done before
-   and the result is stored in the database.
-   
-   If the evolution of VAR is unknown, DONT_KNOW is set to TRUE. The 
-   evolution part of the returned access function is NULL in such cases. 
-   (It is also NULL, when VAR is loop invariant, but in this case DONT_KNOW   
-   is set to FALSE).
 */
 
 tree 
-analyze_scalar_evolution (struct loop *loop, tree var, 
-			  bool analyze, bool *dont_know)
+analyze_scalar_evolution (struct loop *loop, tree var)
 {
   tree res;
 
@@ -1996,10 +1955,7 @@ analyze_scalar_evolution (struct loop *l
       fprintf (dump_file, ")\n");
     }
 
-  *dont_know = false;
-
-  res = analyze_scalar_evolution_1 (loop, var, get_scalar_evolution (var), 
-				    analyze, dont_know);
+  res = analyze_scalar_evolution_1 (loop, var, get_scalar_evolution (var));
 
   if (TREE_CODE (var) == SSA_NAME && res == chrec_dont_know)
     res = var;
@@ -2018,12 +1974,12 @@ static tree
 analyze_scalar_evolution_in_loop (struct loop *wrto_loop, struct loop *use_loop,
 				  tree version)
 {
-  bool val = false, dont_know;
+  bool val = false;
   tree ev = version;
 
   while (1)
     {
-      ev = analyze_scalar_evolution (use_loop, ev, false, &dont_know);
+      ev = analyze_scalar_evolution (use_loop, ev);
       ev = resolve_mixers (use_loop, ev);
 
       if (use_loop == wrto_loop)
@@ -2088,7 +2044,6 @@ instantiate_parameters_1 (struct loop *l
   tree res, op0, op1, op2;
   basic_block def_bb;
   struct loop *def_loop;
-  bool dont_know;
  
   if (chrec == NULL_TREE
       || automatically_generated_chrec_p (chrec))
@@ -2142,7 +2097,7 @@ instantiate_parameters_1 (struct loop *l
       /* If the analysis yields a parametric chrec, instantiate the
 	 result again.  */
       bitmap_set_bit (already_instantiated, SSA_NAME_VERSION (chrec));
-      res = analyze_scalar_evolution (def_loop, chrec, false, &dont_know);
+      res = analyze_scalar_evolution (def_loop, chrec);
       if (res != chrec_dont_know)
 	res = instantiate_parameters_1 (loop, res, allow_superloop_chrecs,
 					cache);
@@ -2574,7 +2529,6 @@ analyze_scalar_evolution_for_all_loop_ph
 {
   unsigned int i;
   struct chrec_stats stats;
-  bool dont_know;
   
   reset_chrecs_counters (&stats);
   
@@ -2604,8 +2558,7 @@ analyze_scalar_evolution_for_all_loop_ph
 	    {
 	      chrec = instantiate_parameters 
 		(loop, 
-		 analyze_scalar_evolution (loop, PHI_RESULT (phi), false,
-                                           &dont_know));
+		 analyze_scalar_evolution (loop, PHI_RESULT (phi)));
 	    
 	      if (dump_file && (dump_flags & TDF_STATS))
 		gather_chrec_stats (chrec, &stats);
Index: tree-scalar-evolution.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-scalar-evolution.h,v
retrieving revision 2.2.30.2
diff -d -u -p -r2.2.30.2 tree-scalar-evolution.h
--- tree-scalar-evolution.h	5 Jul 2005 12:05:50 -0000	2.2.30.2
+++ tree-scalar-evolution.h	15 Aug 2005 17:40:08 -0000
@@ -28,7 +28,7 @@ extern tree get_loop_exit_condition (str
 extern void scev_initialize (struct loops *loops);
 extern void scev_reset (void);
 extern void scev_finalize (void);
-extern tree analyze_scalar_evolution (struct loop *, tree, bool, bool*);
+extern tree analyze_scalar_evolution (struct loop *, tree);
 extern tree instantiate_parameters (struct loop *, tree);
 extern void gather_stats_on_scev_database (void);
 extern void scev_analysis (void);
Index: tree-vect-analyze.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-analyze.c,v
retrieving revision 2.4.4.18
diff -d -u -p -r2.4.4.18 tree-vect-analyze.c
--- tree-vect-analyze.c	5 Jul 2005 12:05:50 -0000	2.4.4.18
+++ tree-vect-analyze.c	15 Aug 2005 17:40:09 -0000
@@ -515,8 +515,7 @@ vect_analyze_scalar_cycles (loop_vec_inf
   tree phi;
   struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
   basic_block bb = loop->header;
-  tree dummy, evolution_part;
-  bool unknown_evolution;
+  tree dummy;
 
   if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
     fprintf (vect_dump, "=== vect_analyze_scalar_cycles ===");
@@ -548,7 +547,7 @@ vect_analyze_scalar_cycles (loop_vec_inf
 
       /* Analyze the evolution function.  */
 
-      access_fn = analyze_scalar_evolution (loop, def, true, &unknown_evolution);
+      access_fn = analyze_scalar_evolution (loop, def);
 
       if (!access_fn)
         continue;
@@ -568,6 +567,8 @@ vect_analyze_scalar_cycles (loop_vec_inf
 	  continue;
 	}
 
+      /* TODO: handle invariant phis  */
+
       reduc_stmt = vect_is_simple_reduction (loop, phi);
       if (reduc_stmt)
         {
@@ -580,26 +581,9 @@ vect_analyze_scalar_cycles (loop_vec_inf
       else
         if (vect_print_dump_info (REPORT_DETAILS, LOOP_LOC (loop_vinfo)))
 	  fprintf (vect_dump, "Unknown def-use cycle pattern.");
-      
-      /* Handle invariant phis.  */
-      evolution_part = evolution_part_in_loop_num (access_fn, loop->num);
-      if (evolution_part == NULL_TREE)
-        {
-          if (unknown_evolution)
-            {
-              if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
-                fprintf (vect_dump, "Unknown def-use cycle pattern.");
-              continue;
-            }
-          else
-            {
-              if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
-                fprintf (vect_dump, "invariant phi. ");
-              STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_invariant_phi_def;
-              continue;
-            }
-        }
     }
+
+  return;
 }
 
 
@@ -2193,7 +2177,6 @@ vect_can_advance_ivs_p (loop_vec_info lo
     {
       tree access_fn = NULL;
       tree evolution_part;
-      bool unknown_evolution;
 
       if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
 	{
@@ -2223,8 +2206,7 @@ vect_can_advance_ivs_p (loop_vec_info lo
       /* Analyze the evolution function.  */
 
       access_fn = instantiate_parameters
-	(loop, analyze_scalar_evolution (loop, PHI_RESULT (phi), true, 
-					 &unknown_evolution));
+	(loop, analyze_scalar_evolution (loop, PHI_RESULT (phi)));
 
       if (!access_fn)
 	{
@@ -2243,18 +2225,9 @@ vect_can_advance_ivs_p (loop_vec_info lo
       
       if (evolution_part == NULL_TREE)
 	{
-	  if (unknown_evolution)
-            {
-              if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
-                fprintf (vect_dump, "No evolution.");
-              return false;
-            }
-          else
-            {
-              if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
-                fprintf (vect_dump, "invariant phi. skip.");
-              continue;
-            }
+	  if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
+	    fprintf (vect_dump, "No evolution.");
+	  return false;
 	}
   
       /* FORNOW: We do not transform initial conditions of IVs 
Index: tree-vect-transform.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-transform.c,v
retrieving revision 2.1.4.16
diff -d -u -p -r2.1.4.16 tree-vect-transform.c
--- tree-vect-transform.c	5 Jul 2005 12:05:50 -0000	2.1.4.16
+++ tree-vect-transform.c	15 Aug 2005 17:40:11 -0000
@@ -529,10 +529,10 @@ vect_get_vec_def_for_operand (tree op, t
   tree vec_inv;
   tree vec_cst;
   tree t = NULL_TREE;
-  tree def, access_fn;
+  tree def;
   int i;
   enum vect_def_type dt;
-  bool is_simple_use, unknown_evolution;
+  bool is_simple_use;
 
   if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
     {
@@ -594,27 +594,7 @@ vect_get_vec_def_for_operand (tree op, t
         vec_inv = build_constructor (vectype, t);
         return vect_init_vector (stmt, vec_inv);
       }
-    
-    /* Case 2.1: invariant phi.  */
-    case vect_invariant_phi_def:
-      {
-        /* Create 'vec_inv = {inv,inv,..,inv}'  */
-        if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
-          fprintf (vect_dump, "Create vector_inv for invariant phi ");
-          
-        access_fn = analyze_scalar_evolution (loop, def, true,
-                                              &unknown_evolution);
-        gcc_assert (!unknown_evolution
-                    && !evolution_part_in_loop_num (access_fn, loop->num));
-        for (i = nunits - 1; i >= 0; --i)
-          {
-            t = tree_cons (NULL_TREE, access_fn, t);
-          }
-       
-        vec_inv = build_constructor (vectype, t);
-        return vect_init_vector (stmt, vec_inv);
-      }
-
+  
     /* Case 3: operand is defined inside the loop.  */
     case vect_loop_def:
       {
@@ -2505,7 +2485,6 @@ vect_update_ivs_after_vectorizer (loop_v
   basic_block exit_bb = loop->single_exit->dest;
   tree phi, phi1;
   basic_block update_bb = update_e->dest;
-  bool unknown_evolution;
 
   /* gcc_assert (vect_can_advance_ivs_p (loop_vinfo)); */
 
@@ -2545,25 +2524,18 @@ vect_update_ivs_after_vectorizer (loop_v
           continue; 
         } 
 
-      access_fn = analyze_scalar_evolution (loop, PHI_RESULT (phi), true,
-					    &unknown_evolution); 
+      access_fn = analyze_scalar_evolution (loop, PHI_RESULT (phi)); 
       gcc_assert (access_fn);
 
       if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
 	{
-	  fprintf (vect_dump, "access funcion for phi: ");
+	  fprintf (vect_dump, "accesses funcion for phi: ");
 	  print_generic_expr (vect_dump, access_fn, TDF_SLIM);
 	}
 
       evolution_part =
 	 unshare_expr (evolution_part_in_loop_num (access_fn, loop->num));
-      if (evolution_part == NULL_TREE)
-	{  
-	  gcc_assert (!unknown_evolution);
-	  if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
-	    fprintf (vect_dump, "invariant phi. skip.");
-	  continue;
-       }
+      gcc_assert (evolution_part != NULL_TREE);
       
       /* FORNOW: We do not support IVs whose evolution function is a polynomial
          of degree >= 2 or exponential.  */
Index: tree-vectorizer.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.h,v
retrieving revision 2.7.2.20
diff -d -u -p -r2.7.2.20 tree-vectorizer.h
--- tree-vectorizer.h	5 Jul 2005 12:05:50 -0000	2.7.2.20
+++ tree-vectorizer.h	15 Aug 2005 17:40:11 -0000
@@ -61,7 +61,6 @@ enum dr_alignment_support {
 enum vect_def_type {
   vect_constant_def,
   vect_invariant_def,
-  vect_invariant_phi_def,
   vect_loop_def,
   vect_induction_def,
   vect_reduction_def,


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