This is the mail archive of the gcc@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: Still missing some addr_expr invariant recomputations


On Monday 13 September 2004 21:47, Richard Henderson wrote:
> On Mon, Sep 13, 2004 at 09:15:26PM +0200, Steven Bosscher wrote:
> > *************** eliminate_redundant_computations (struct
> > *** 2451,2456 ****
> > --- 2452,2461 ----
> >   	retval = true;
> >
> >         propagate_tree_value (expr_p, cached_lhs);
> > +
> > +       if (TREE_CODE (cached_lhs) == ADDR_EXPR)
> > + 	recompute_tree_invarant_for_addr_expr (*expr_p);
> > +
> >         modify_stmt (stmt);
> >       }
> >     return retval;
> > *************** cprop_operand (tree stmt, use_operand_p
> > *** 2674,2679 ****
> > --- 2679,2687 ----
> >
> >         propagate_value (op_p, val);
> >
> > +       if (TREE_CODE (val) == ADDR_EXPR)
> > + 	recompute_tree_invarant_for_addr_expr (val);
> > +
> >         /* And note that we modified this statement.  This is now
> >   	 safe, even if we changed virtual operands since we will
> >   	 rescan the statement and rewrite its operands again.  */
>
> I don't understand these.  In both cases isn't the ADDR_EXPR
> the thing being propagated, not the destination?
>
> > +   rhs = get_rhs (stmt);
> > +   if (rhs && TREE_CODE (rhs) == ADDR_EXPR)
> > +     recompute_tree_invarant_for_addr_expr (rhs);
>
> I suspect this is the only hunk that does anything.  And it'd be
> nice to only do this when we actually substituted something in
> this statement, rather than every time this statement is processed.

Guys guys,

I said "try this", it never was intended for review!  :-)

The if (TREE_CODE (val) == ADDR_EXPR) case appears to be necessary,
the if (TREE_CODE (cached_lhs) == ADDR_EXPR) maybe not, I haven't
tried without that.  I just put the recompute in all places where
we substitute into an ADDR_EXPR.
Indeed, I guess the cached_lhs is actually an ADDR_EXPR *being*
propagated, so that shouldn't have an effect.  Thanks for spotting
that thinko.

Anyway, I've bootstrapped with this hacked patch and Dan's checking
patch.  I'll post the checking patch and the fix as a proper patch
after cleaning it up and testing it on a few targets (ie. tomorrow
morning).

Gr.
Steven




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