--- Comment #8 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Date: Mon Apr 15 11:33:29 2019
New Revision: 270368
combine: Count auto_inc properly (PR89794)
The code that checks if an auto-increment from i0 or i1 is not lost is
a bit shaky. The code to check the same for i2 is non-existent, and
cannot be implemented in a similar way at all. So, this patch counts
all auto-increments, and makes sure we end up with the same number as
we started with. This works because we still have a check that we
will not duplicate any.
We should do this some better way, but not while we are in stage 4.
* combine.c (count_auto_inc): New function.
(try_combine): Count how many auto_inc expressions there were in the
original instructions. Ensure we have the same number in the new
instructions. Remove the code that tried to ensure auto_inc side
effects on i1 and i0 are not lost.
* gcc.dg/torture/pr89794.c: New testcase.