On 07/10/15 19:18, Andrew Pinski wrote:
On Wed, Oct 7, 2015 at 9:11 AM, Maxim Ostapenko
<m.ostape...@partner.samsung.com> wrote:
Hi,
when testing OpenSSL performance, I found out that sometimes PGO-built
binaries can actually introduce performance regressions. We could identify
affected object files and disable PGO for them by simply removing
corresponding .gcda file. However, even if profile data is not presented,
GCC doesn't switch back -fprofile-use dependent optimizations (e.g.
-fbranch-probabilities, -fvpt, etc). This may also lead to performance
degradations.
The issue had already raised quite time ago
(https://gcc.gnu.org/ml/gcc-patches/2009-09/msg02119.html), but for some
reasons wasn't discussed.
Here a draft patch that disables -fprofile-use related optimizations if
profile data wasn't found (perhaps it makes sense to introduce a special
switch for this?). Does this look reasonable?
I thought if profile is not present, then branch probabilities goes
back to the original heuristics?
Which option is really causing the performance degradation here?
-fprofile-use enabled -fpeel-loops that in turn enabled
-frename-registers. This caused the scheduler to transform the code in
sched2 pass.
Also I think your patch is very incomplete as someone could use
-frename-registers with -fprofile-use and then you just turned it off.
Thanks,
Andrew Pinski
Doesn't -fprofile-use enable -frename-registers transitively through
-fpeel-loops?
Thanks,
-Maxim