This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PING][PATCH] tailcall: Handle NEGATE_EXPR and MINUS_EXPR
- From: Zdenek Dvorak <rakdver at kam dot mff dot cuni dot cz>
- To: Giuseppe Scrivano <gscrivano at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 24 Aug 2010 12:06:05 +0200
- Subject: Re: [PING][PATCH] tailcall: Handle NEGATE_EXPR and MINUS_EXPR
- References: <87wrrht5pf.fsf_-_@valhalla.homenet>
Hi,
> Giuseppe Scrivano <gscrivano@gnu.org> writes:
>
> > gcc/ChangeLog
> >
> > 2010-08-13 Giuseppe Scrivano <gscrivano@gnu.org>
> >
> > * tree-tailcall.c (process_assignment): Handle NEGATE_EXPR and
> > MINUS_EXPR.
> >
> > - if (op0 == *ass_var
> > + if (rhs_class == GIMPLE_UNARY_RHS)
> > + non_ass_var = op0;
using non_ass_var to store op0 in this case is somewhat confusing. Instead, it would be better to
set non_ass_var to NULL and ...
> > + case NEGATE_EXPR:
> > + if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var)))
> > + return false;
> > +
> > + *m = build_int_cst (TREE_TYPE (non_ass_var), -1);
... use *ass_var instead of non_ass_var here.
> > + case MINUS_EXPR:
> > +
> > + if (*ass_var == op0)
> > + *a = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var), non_ass_var);
> > + else
> > + {
> > + if (FLOAT_TYPE_P (TREE_TYPE (non_ass_var)))
> > + return false;
This restriction seems unnecessary. Just use build_real (type, dconstm1) instead of build_int_cst
if the type is floating.
Other than that, I think the patch is OK (but I do not have right to approve it).
Zdenek