This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lno] Enable use of scev in ivcanon
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 20 Mar 2004 11:14:19 +0100
- Subject: [lno] Enable use of scev in ivcanon
Hello,
this patch fixes a small bug in scev, thus making it possible to finally
enable its usage in ivcanon pass.
Zdenek
Index: ChangeLog.lno
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.lno,v
retrieving revision 1.1.2.93
diff -c -3 -p -r1.1.2.93 ChangeLog.lno
*** ChangeLog.lno 19 Mar 2004 23:39:19 -0000 1.1.2.93
--- ChangeLog.lno 20 Mar 2004 10:12:07 -0000
***************
*** 1,5 ****
--- 1,12 ----
2004-03-20 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+ * tree-chrec.c (chrec_fold_multiply_ival_cst): Handle negative
+ constants correctly.
+ * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
+ Enable use of scev.
+
+ 2004-03-20 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
PR optimization/14658
* loop-invariant.c (move_invariant_reg): Handle assignments
with nontrivial lhs correctly.
Index: tree-chrec.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-chrec.c,v
retrieving revision 1.1.2.7
diff -c -3 -p -r1.1.2.7 tree-chrec.c
*** tree-chrec.c 17 Mar 2004 18:39:41 -0000 1.1.2.7
--- tree-chrec.c 20 Mar 2004 10:12:07 -0000
*************** chrec_fold_multiply_expo_cst (tree expo,
*** 543,551 ****
/* Fold the multiplication of an interval and a constant. */
static inline tree
! chrec_fold_multiply_ival_cst (tree ival,
! tree cst)
{
#if defined ENABLE_CHECKING
if (ival == NULL_TREE
|| cst == NULL_TREE
--- 543,553 ----
/* Fold the multiplication of an interval and a constant. */
static inline tree
! chrec_fold_multiply_ival_cst (tree ival, tree cst)
{
+ tree lowm, upm;
+ bool pos;
+
#if defined ENABLE_CHECKING
if (ival == NULL_TREE
|| cst == NULL_TREE
*************** chrec_fold_multiply_ival_cst (tree ival,
*** 553,568 ****
|| is_not_constant_evolution (cst))
abort ();
#endif
!
/* Don't modify abstract values. */
if (ival == chrec_top)
return chrec_top;
if (ival == chrec_bot)
return chrec_bot;
!
! return build_interval_chrec
! (chrec_fold_multiply (CHREC_LOW (ival), cst),
! chrec_fold_multiply (CHREC_UP (ival), cst));
}
/* Fold the multiplication of two polynomial functions. */
--- 555,577 ----
|| is_not_constant_evolution (cst))
abort ();
#endif
!
/* Don't modify abstract values. */
if (ival == chrec_top)
return chrec_top;
if (ival == chrec_bot)
return chrec_bot;
!
! if (!chrec_is_positive (cst, &pos))
! return chrec_top;
!
! lowm = chrec_fold_multiply (CHREC_LOW (ival), cst);
! upm = chrec_fold_multiply (CHREC_UP (ival), cst);
!
! if (pos)
! return build_interval_chrec (lowm, upm);
! else
! return build_interval_chrec (upm, lowm);
}
/* Fold the multiplication of two polynomial functions. */
Index: tree-ssa-loop-ivcanon.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-loop-ivcanon.c,v
retrieving revision 1.1.2.3
diff -c -3 -p -r1.1.2.3 tree-ssa-loop-ivcanon.c
*** tree-ssa-loop-ivcanon.c 17 Mar 2004 18:39:43 -0000 1.1.2.3
--- tree-ssa-loop-ivcanon.c 20 Mar 2004 10:12:07 -0000
*************** canonicalize_loop_induction_variables (s
*** 418,424 ****
niter = number_of_iterations_in_loop (loop);
! if (0 && TREE_CODE (niter) == INTEGER_CST)
{
tree nit;
edge ex;
--- 418,424 ----
niter = number_of_iterations_in_loop (loop);
! if (TREE_CODE (niter) == INTEGER_CST)
{
tree nit;
edge ex;
*************** canonicalize_loop_induction_variables (s
*** 434,445 ****
--- 434,447 ----
convert (TREE_TYPE (niter),
integer_minus_one_node)));
+ #ifdef ENABLE_CHECKING
nit = find_loop_niter_by_eval (loop, &ex);
if (ex == exit
&& TREE_CODE (nit) == INTEGER_CST
&& !operand_equal_p (niter, nit, 0))
abort ();
+ #endif
}
else
niter = find_loop_niter_by_eval (loop, &exit);