[PATCH] Amend match.pd syntax with force-simplified results

Marc Glisse marc.glisse@inria.fr
Tue Aug 4 16:41:40 GMT 2020


On Fri, 31 Jul 2020, Richard Biener wrote:

> This adds a ! marker to result expressions that should simplify
> (and if not fail the simplification).  This can for example be
> used like
>
> (simplify
>  (plus (vec_cond:s @0 @1 @2) @3)
>  (vec_cond @0 (plus! @1 @3) (plus! @2 @3)))
>
> to make the simplification only apply in case both plus operations
> in the result end up simplified to a simple operand.

(replacing plus with bit_ior)
The generated code in gimple_simplify_BIT_IOR_EXPR may look like

   {
     tree _o1[2], _r1;
     _o1[0] = captures[2];
     _o1[1] = captures[4];
     gimple_match_op tem_op (res_op->cond.any_else (), BIT_IOR_EXPR, TREE_TYPE (_o1[0]), _o1[0], _o1[1]);
     tem_op.resimplify (lseq, valueize);
     _r1 = maybe_push_res_to_seq (&tem_op, NULL);
     if (!_r1) return false;
     res_op->ops[1] = _r1;
   }

In particular, it contains this "return false" which directly exits the 
function, instead of just giving up on this particular transformation and 
trying the next one. I'll reorder my transformations to work around this, 
but it looks like a pre-existing limitation.

-- 
Marc Glisse


More information about the Gcc-patches mailing list