This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Prevent -fprofile-arcs and -fbranch-probabilities rtl from diverging


Hello,

> >>Hmm, it's not immediately obvious to me as to why inserting the
> >>gcov_flush call causes the bb graph to change.
> >
> >
> >because the optimizations before the profiling now work on different
> >code, and thus behave slightly differently; I did not hunt the change
> >down to one particular optimization (mostly because it would be a clear
> >waste of the time -- there is nothing wrong with the optimization and
> >avoiding this behavior is not a correct way of fixing the problem).
> I do not understand what you are saying here.

with -fbranch-probabilities, the code looks like

...
fork
...

with -fprofile-arcs, it looks like

...
gcov_flush
fork
...

This code is slightly different, and causes one of the optimizations
before the profile feedback pass to behave differently, in effect
causing the profiled code to be significantly different.

> Do you have a test case?

take perl benchmark from the specint testsuite, apply this patch

http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01150.html,

compile (on x86_64) with -O2 -march=k8 -fspeculative-prefetching -fprofile-arcs

measure the profile

compile doio.c with -O2 -march=k8 -fspeculative-prefetching -fbranch-probabilities

Sorry, I do not have a smaller test (it is quite complicated to
minimize this kind of code).

Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]