On Mon, Jul 19, 2021 at 12:03 AM Marc Glisse <marc.gli...@inria.fr> wrote: > > On Sun, 18 Jul 2021, Roger Sayle wrote: > > > + (if (GIMPLE || !TREE_SIDE_EFFECTS (@0)) > > I don't think you need to worry about that, the general genmatch machinery > is already supposed to take care of it. All the existing cases in match.pd > are about cond_expr, where counting the occurrences of each @i is not > reliable.
Yes, genmatch tries to track omitted and duplicated operands and appropriately preserves side-effects. When you invoke genmatch with -v then you might see warnings like "forcing no side-effects on possibly lost leaf" when it was not possible to see exactly whether a capture was dropped or used multiple times. Richard. > > -- > Marc Glisse