https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93002

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-12-19
                 CC|                            |amker at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org,
                   |                            |rth at gcc dot gnu.org,
                   |                            |uros at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The question is where to do that.  Is that something ivopts should do (perhaps
based on some rtl cost or whatever), or shall it be done during expansion
(unfortunately, expansion expands the decrement and comparison separately,
because the result of decrement is used multiple times, but on the other hand
has the range information, like for unsigned iterator:
  # RANGE ~[999, 4294967294]
  i_5 = i_12 + 4294967295;
  if (i_5 != 4294967295)
or for signed one:
  # RANGE [-1, 998]
  i_4 = i_11 + -1;
  if (i_4 != -1(OVF))
or shall config/i386 enable the doloop patterns?  Or peephole2?
Combine won't do anything, as the result of the decrement is used multiple
times.
Or compare-elim.c?  That one fails, because it tries to
(parallel [
        (set (reg:CCZ 17 flags)
            (compare:CCZ (plus:SI (reg/v:SI 0 ax [orig:83 i ] [83])
                    (const_int -1 [0xffffffffffffffff]))
                (const_int -1 [0xffffffffffffffff])))
        (set (reg/v:SI 0 ax [orig:83 i ] [83])
            (plus:SI (reg/v:SI 0 ax [orig:83 i ] [83])
                (const_int -1 [0xffffffffffffffff])))
    ])
and the CCZmode is really wrong in this case, for this optimization we really
need CCmode or something similar and make try_eliminate_compare adjust also the
mode on the use of the flags register if possible.  CCing also Richard as
compare-elim.c author.
Doing it in peephole2 would require that the 3 insns are consecutive, which is
the case here.

Reply via email to