This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
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
name).
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.
Diego.