[Bug ipa/88702] [6/7/8 regression] We do terrible job optimizing IsHTMLWhitespace from Firefox

2019-01-05 Thread hubicka at ucw dot cz
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88702

--- Comment #4 from Jan Hubicka  ---
> The only pass that can do about this (at least right now) is reassoc (both 1
> and 2), which is too late for inlining.  So, either teach fnsplit not to
> separate multiple if comparisons of the same variable against constants, or
> schedule reasoc or just the maybe_optimize_range_tests part thereof in some
> early pass.

Yep, I also found out about reassoc.
Teaching fnsplit to pattern match this is just a partial solution - we
would still miscalculate size of function body for functions like this
(which indeed look quite common). I will experiment with early reassoc.

I kind of debugged what happens later. Because code is compiled with -O2
and growth gets positive for both inlines and functions are not inline,
we won't inline.

[Bug ipa/88702] [6/7/8 regression] We do terrible job optimizing IsHTMLWhitespace from Firefox

2019-01-04 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88702

--- Comment #3 from Jakub Jelinek  ---
The only pass that can do about this (at least right now) is reassoc (both 1
and 2), which is too late for inlining.  So, either teach fnsplit not to
separate multiple if comparisons of the same variable against constants, or
schedule reasoc or just the maybe_optimize_range_tests part thereof in some
early pass.

[Bug ipa/88702] [6/7/8 regression] We do terrible job optimizing IsHTMLWhitespace from Firefox

2019-01-04 Thread hubicka at ucw dot cz
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88702

--- Comment #2 from Jan Hubicka  ---
> With what options?  I'm getting 3 bit tests both with -O2 and -O3, both when
> using C and C++.  And get that also if I rewrite the function to use a switch
> instead.

-O2 -flto and then look into release_ssa dump.
In Firefox we then fail to inline things back together. I am debugging
that but already producing that at firstplace is bad.

[Bug ipa/88702] [6/7/8 regression] We do terrible job optimizing IsHTMLWhitespace from Firefox

2019-01-04 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88702

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
With what options?  I'm getting 3 bit tests both with -O2 and -O3, both when
using C and C++.  And get that also if I rewrite the function to use a switch
instead.