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: [PING][PATCH] tailcall: Handle NEGATE_EXPR and MINUS_EXPR


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


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