> -----Original Message-----
> From: Richard Biener [mailto:richard.guent...@gmail.com]
> Sent: 20 December 2012 16:13
> To: Paulo Matos
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: Fix PR55761
> 
> On Thu, Dec 20, 2012 at 5:06 PM, Paulo Matos <pma...@broadcom.com> wrote:
> > 2012-12-20 Paulo Matos <pma...@broadcom.com>
> >
> >         PR tree-optimization/55761
> >         * tree-tailcall.c (process_assignment): Use build_int_cst only for
> integral types,
> >         for every other type that managed to pass all conditions use
> fold_build1.
> 
>      case NEGATE_EXPR:
>        if (FLOAT_TYPE_P (TREE_TYPE (op0)))
>          *m = build_real (TREE_TYPE (op0), dconstm1);
> +      else if (INTEGRAL_TYPE_P (TREE_TYPE (non_ass_var)))
> +        *m = build_int_cst (TREE_TYPE (non_ass_var), -1);
>        else
> -        *m = build_int_cst (TREE_TYPE (op0), -1);
> +        *m = fold_build1 (NEGATE_EXPR, TREE_TYPE (non_ass_var),
> non_ass_var);
> 
> looks bogus (op0 vs. non_ass_var). 

Correct. My mistake applying same MINUS_EXPR pattern to NEGATE_EXPR case.

> I'd rather use fold_unary here as I'm not
> sure if callers handle a NEGATE_EXPR in *m.  And I'd use that
> unconditionally,
> this last case looks like it will have very weak testing coverage.  Thus,
> 
>    *m = fold_unary (NEGATE_EXPR, TREE_TYPE (op0), op0);
> 
> and also in the MINUS_EXPR case.
> 

Sounds reasonable. That would simplify it, it seems. Will fix patch and replace 
it in PR.

> Richard.

Reply via email to