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: [PATCH][4/n] Merge from match-and-simplify, hook into fold-const.c


Richard Biener wrote:
> To give you an example how it looks like, the following code is
> generated for
> 
> /* fold_negate_exprs convert - (~A) to A + 1.  */
> (simplify
>  (negate (bit_not @0))
>  (if (INTEGRAL_TYPE_P (type))
>   (plus @0 { build_int_cst (TREE_TYPE (@0), 1); } )))
> 
> tree
> generic_simplify (enum tree_code code, tree type ATTRIBUTE_UNUSED, tree op0)

I wonder why ATTRIBUTE_UNUSED is generated for used parameters.

> {
>   if ((op0 && TREE_SIDE_EFFECTS (op0)))
>     return NULL_TREE;
>   switch (code)
>     {
> ...
>     case NEGATE_EXPR:
>       {
>         switch (TREE_CODE (op0))
>           {
>           case BIT_NOT_EXPR:
>             {
>               tree o20 = TREE_OPERAND (op0, 0);
>                 {
>                   /* #line 136 "/space/rguenther/src/svn/match-and-simplify/gcc/match.pd" */
>                   tree captures[2] ATTRIBUTE_UNUSED = {};

Same here.
Also, why do we allocate two elements when only captures[0] is used?

>                   captures[0] = o20;
>                   /* #line 135 "/space/rguenther/src/svn/match-and-simplify/gcc/match.pd" */
>                   if (INTEGRAL_TYPE_P (type))
>                     {
>                       if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Applying pattern match.pd:136, %s:%d\n", __FILE__, __LINE__);
>                       tree res_op0;
>                       res_op0 = captures[0];
>                       tree res_op1;
>                       res_op1 =  build_int_cst (TREE_TYPE (captures[0]), 1);
>                       return fold_build2 (PLUS_EXPR, type, res_op0, res_op1);
>                     }
>                 }
>               break;
>             }
> ...


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