This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Prevent -fprofile-arcs and -fbranch-probabilities rtl from diverging
> >>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
with -fprofile-arcs, it looks like
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
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).