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: [tree-ssa] Tail recursion improvement


In message <20040225075130.GA20753@atrey.karlin.mff.cuni.cz>, Zdenek Dvorak wri
tes:
 >> You don't actually use the result of propagate_through_phis to do any
 >> kind of expression replacement do you (such as we recently found in
 >> tree-ssa-pre.c).  If so, then we'll need some adjustments to ensure
 >> that the annotations are kept up-to-date.
 >
 >Not here, but the result of independent_on_stmt_p is used.  What needs
 >to be done?
If you replace an SSA_NAME in an expression with a different SSA_NAME,
then you need to make sure the annotations are updated (such as type_mem_tag).
the type_mem_tag in the annotation 

replace_exp will handle all this for you.

For this particular code it appears that you are generating a totally new
expression using the result of independent_on_stmt_p and I'm pretty sure
you're safe in this case.

 >Index: tree-optimize.c
As discussed, the tree-optimize.c change is wrong.  I did a new test cycle
without the tree-optimize.c change.


 >+    To do this, we maintain two accumulators (a_acc and m_acc) that say us 
 >that
 >+    when we reach the return x statement, we should return a_acc + x * m_acc
 >+    instead. 
I replaced "that say us that" "that indicate"


 >! /* Checks whether the expression EXPR in stmt AT is independent on the
 >!    statement pointed by BSI (in a sense that we already know its value
 >!    there).  We use the fact that we are only called from the chain of
 >!    basic blocks that have only single successor.  Returns the expression
 >!    containing the value of EXPR at BSI.  */
I reworded this comment slightly to avoid ambiguous pronouns.  I also
renamed the function to be "independent_of_stmt_p", which I think is more
correct.  The comment now looks like:

/* Checks whether the expression EXPR in stmt AT is independent of the
   statement pointed by BSI (in a sense that we already know EXPR's value
   at BSI).  We use the fact that we are only called from the chain of
   basic blocks that have only single successor.  Returns the expression
   containing the value of EXPR at BSI.  */
                                                                               



I'm going to go ahead and check in your patch momentarily (without the
tree-optimize.c change).  I did a bootstrap and check cycle on 
i686-pc-linux-gnu.

jeff



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