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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-08-10
                 CC|                            |amonakov at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
This is interesting. First scev-cprop emits computation of final value of 'buf'
before the inner loop. Then ivopts emits the same, but *after* the loop. In
gcc-8, ivopts uses a slightly more efficient form though, so dom3 fails to
unify the two, and we end up with redundant computations. Previously two final
value computations were identical and dom3 managed to clean up.

Final value replacement is unnecessary in this case, 'buf' remains used in the
loop and the final value is non-constant so doesn't lead to further
simplification. I believe we should try to throttle down scev-cprop (especially
for -Os, but likely for -O2 as well).

Emitting final value in the loop preheader instead of after exit may also be
useful as it may reduce the amount of variables that live across the loop.

(-fno-tree-scev-cprop leads to good code on the testcase)

Reply via email to