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]

[lno] Fix type error in iv elimination


Hello,

this patch fixes a wrong type given to the expressions used during
induction variable elimination, thus fixing one of the bootstrap
problems on ia64 (still we do not bootstrap there, I am investigating
the further problems).

Zdenek

Index: ChangeLog.lno
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.lno,v
retrieving revision 1.1.2.107
diff -c -3 -p -r1.1.2.107 ChangeLog.lno
*** ChangeLog.lno	30 Mar 2004 01:39:54 -0000	1.1.2.107
--- ChangeLog.lno	30 Mar 2004 13:23:59 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2004-03-30  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+ 
+ 	* tree-ssa-loop-ivopts.c (iv_value): Use correct type.
+ 	(may_eliminate_iv): Add a fixme comment.
+ 
  2004-03-29  Devang Patel  <dpatel@apple.com>
  
  	* tree-flow.h (tree_ssa_loop_version): Add new parameter, basic_block *.
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-loop-ivopts.c,v
retrieving revision 1.1.2.20
diff -c -3 -p -r1.1.2.20 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c	27 Mar 2004 18:29:36 -0000	1.1.2.20
--- tree-ssa-loop-ivopts.c	30 Mar 2004 13:24:00 -0000
*************** static tree
*** 3600,3607 ****
  iv_value (struct iv *iv, tree niter)
  {
    tree val;
!   tree type = TREE_TYPE (niter);
  
    val = fold (build (MULT_EXPR, type, iv->step, niter));
  
    return fold (build (PLUS_EXPR, type, iv->base, val));
--- 3600,3608 ----
  iv_value (struct iv *iv, tree niter)
  {
    tree val;
!   tree type = TREE_TYPE (iv->base);
  
+   niter = convert (type, niter);
    val = fold (build (MULT_EXPR, type, iv->step, niter));
  
    return fold (build (PLUS_EXPR, type, iv->base, val));
*************** may_eliminate_iv (struct loop *loop,
*** 3648,3653 ****
--- 3649,3657 ----
        || !operand_equal_p (niter->may_be_zero, boolean_false_node, 0))
      return false;
  
+   /* FIXME -- we ignore the possible overflow here.  For example
+      in case the loop iterates MAX_UNSIGNED_INT / 2 times and
+      the step of candidate is 4, this is wrong.  */
    if (exit->flags & EDGE_TRUE_VALUE)
      *compare = EQ_EXPR;
    else


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