[lno] some cleanups for scev

Sebastian Pop sebastian.pop@cri.ensmp.fr
Tue Apr 20 15:10:00 GMT 2004


Some more fixes.  

Bootstrapped on amd64-unknown-freebsd5.2,
BOOTCFLAGS='-g -O2 -ftree-elim-checks -fdump-tree-elck-details
-fscalar-evolutions -fdump-tree-scev -fall-data-deps -fdump-tree-ddall'

	* tree-chrec.c (chrec_fold_multiply_ival_cst): Compute the min
	and max on the multiplication result.
	(chrec_fold_negate): Removed.
	* tree-chrec.h (chrec_fold_negate): Removed.
	* tree-scalar-evolution.c (interpret_rhs_modify_expr): 
	Use chrec_fold_minus instead of chrec_fold_negate.

Index: tree-chrec.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-chrec.c,v
retrieving revision 1.1.2.15
diff -d -u -p -r1.1.2.15 tree-chrec.c
--- tree-chrec.c	20 Apr 2004 11:47:19 -0000	1.1.2.15
+++ tree-chrec.c	20 Apr 2004 14:27:34 -0000
@@ -453,7 +453,6 @@ chrec_fold_multiply_ival_cst (tree type,
 			      tree cst)
 {
   tree lowm, upm;
-  bool pos;
 
 #if defined ENABLE_CHECKING
   if (ival == NULL_TREE
@@ -469,16 +468,11 @@ chrec_fold_multiply_ival_cst (tree type,
   if (ival == chrec_bot)
     return chrec_bot;
 
-  if (!chrec_is_positive (cst, &pos))
-    return chrec_top;
-  
   lowm = chrec_fold_multiply (type, CHREC_LOW (ival), cst);
   upm = chrec_fold_multiply (type, CHREC_UP (ival), cst);
-  
-  if (pos)
-    return build_interval_chrec (lowm, upm);
-  else
-    return build_interval_chrec (upm, lowm);
+
+  return build_interval_chrec (tree_fold_min (type, lowm, upm),
+			       tree_fold_max (type, lowm, upm));
 }
 
 /* Fold the multiplication of two polynomial functions.  */
@@ -827,7 +821,7 @@ chrec_fold_plus_1 (enum tree_code code, 
 	     CHREC_RIGHT (op1));
 	  
 	case EXPONENTIAL_CHREC:
-	  return chrec_fold_plus_cst_expo (code, type, op0, op1);
+	  return chrec_top;
 	  
 	case INTERVAL_CHREC:
 	  t1 = (code == PLUS_EXPR ? 
@@ -945,21 +939,6 @@ chrec_fold_minus (tree type, 
   return chrec_fold_plus_1 (MINUS_EXPR, type, op0, op1);
 }
 
-/* Fold the negation of a two chrec.  */
-
-tree 
-chrec_fold_negate (tree type, tree op0)
-{
-  if (integer_zerop (op0)
-      || (TREE_CODE (op0) == INTERVAL_CHREC
-	  && integer_zerop (CHREC_LOW (op0))
-	  && integer_zerop (CHREC_UP (op0))))
-    return op0;
-  
-  return chrec_fold_plus_1 (MINUS_EXPR, type,
-			    convert (type, integer_zero_node),
-			    op0);
-}
 /* Fold the multiplication of two chrecs.  */
 
 tree
Index: tree-chrec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-chrec.h,v
retrieving revision 1.1.2.12
diff -d -u -p -r1.1.2.12 tree-chrec.h
--- tree-chrec.h	20 Apr 2004 13:49:24 -0000	1.1.2.12
+++ tree-chrec.h	20 Apr 2004 14:27:34 -0000
@@ -78,7 +78,6 @@ static inline tree build_peeled_chrec (u
 /* Chrec folding functions.  */
 extern tree chrec_fold_plus (tree, tree, tree);
 extern tree chrec_fold_minus (tree, tree, tree);
-extern tree chrec_fold_negate (tree, tree);
 extern tree chrec_fold_multiply (tree, tree, tree);
 extern tree chrec_convert (tree, tree);
 extern tree chrec_type (tree);
Index: tree-scalar-evolution.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-scalar-evolution.c,v
retrieving revision 1.1.2.33
diff -d -u -p -r1.1.2.33 tree-scalar-evolution.c
--- tree-scalar-evolution.c	20 Apr 2004 11:47:19 -0000	1.1.2.33
+++ tree-scalar-evolution.c	20 Apr 2004 14:27:35 -0000
@@ -2550,7 +2550,8 @@ interpret_rhs_modify_expr (struct loop *
       opnd10 = TREE_OPERAND (opnd1, 0);
       chrec10 = analyze_scalar_evolution (loop, opnd10);
       chrec10 = chrec_convert (type, chrec10);
-      res = chrec_fold_negate (type, chrec10);
+      res = chrec_fold_minus (type, convert (type, integer_zero_node), 
+			      chrec10);
       break;
 
     case MULT_EXPR:



More information about the Gcc-patches mailing list