This is the mail archive of the 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: [PATCH] Fix 14844/15459/21608: Forward-propagate casts that will collapse

On Tue, May 24, 2005 at 03:04:27PM -0700, Richard Henderson wrote:
> On Tue, May 24, 2005 at 02:53:36PM -0600, Jeffrey A Law wrote:
> > >  Forwprop is not the place for this optimization.
> > I'm less sure about this.  Ultimately everything in forwprop.c is
> > just tree combination (run forward rather than reverse).  At least
> > some cases of NOP_EXPR removal clearly fall under the category of
> > tree combination.
> I was thinking that this was copy-prop with some extra checks
> at the substitution point.
Not by hacking into copy-prop, I hope.

If you describe it as an expression propagation problem, you
could define the values as expressions, when visiting an
assignment you return "interesting" if after plugging the
expression-values on the operands of the RHS you get a "simpler"
RHS (where "simpler" could be fewer operands, or even just an SSA

Similarly, your PHI visiting function meets all the
expression-values and returns "interesting" if all the arguments
have the same expression-value (using operand_equal_p, I guess).

It wouldn't be cheap, but it could probably be made to solve many
expression combination/simplification problems.


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