This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/18431] Code for arrays and pointers are not the same


------- Additional Comments From rakdver at atrey dot karlin dot mff dot cuni dot cz  2004-11-12 14:46 -------
Subject: Re:  Code for arrays and pointers are not the same

> > Patch here which should fix not pulling the load of q out of the loop:
> > http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00957.html
> > 
> > Then the only thing left is for IV-OPTS to be fixed.
> 
> no -- once this is done, ivopts work just fine, producing the same code
> as for array access.

btw. the patch above might be wrong -- I think ssa names also pass the
is_gimple_addressable test:

is_gimple_addressable -> is_gimple_id -> is_gimple_variable -> SSA_NAME.

So the correct patch would be

Index: tree-ssa-loop-im.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-im.c,v
retrieving revision 2.21
diff -c -3 -p -r2.21 tree-ssa-loop-im.c
*** tree-ssa-loop-im.c	8 Nov 2004 13:54:39 -0000	2.21
--- tree-ssa-loop-im.c	12 Nov 2004 11:29:40 -0000
*************** stmt_cost (tree stmt)
*** 367,373 ****
    /* Hoisting memory references out should almost surely be a win.  */
    if (!is_gimple_variable (lhs))
      cost += 20;
!   if (is_gimple_addressable (rhs) && !is_gimple_variable (rhs))
      cost += 20;
  
    switch (TREE_CODE (rhs))
--- 367,373 ----
    /* Hoisting memory references out should almost surely be a win.  */
    if (!is_gimple_variable (lhs))
      cost += 20;
!   if (is_gimple_addressable (rhs) && TREE_CODE (rhs) != SSA_NAME)
      cost += 20;
  
    switch (TREE_CODE (rhs))


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18431


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