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 rtlfrom diverging


Zdenek,
in code that calls fork or exec functions, the rtl generated for
-fprofile-arcs slightly differ from the one generated for
-fbranch-probabilities, since in the former case we insert calls to
gcov_flush before fork/exec.  This may cause the code diverge (as indeed
happened to me during value profiling enhancement testing) enough so
that the counters issued with -fprofile-arcs do not those that
-fbranch-probabilities expects.

This patch fixes it (or better said, moves it closer to the correct
state) by replacing the fork/exec call by a call to a library function
that calls gcov_flush and the original function, in the program compiled
with -fprofile-arcs.  This makes the code more similar, thus preventing
the divergence.
Hmm, it's not immediately obvious to me as to why inserting the
gcov_flush call causes the bb graph to change. Unless there's a
no-return edge being inserted.  couldn't we supress that edge
for this particular call?

Of course this will become unnecesary once the profiling is done on
trees, since there it won't be a problem to insert the gcov_flush
calls after the profile feedback stage.
This patch is large and it is a stopgap measure within
the current development series. We run the significant risk of it
remaining in the compiler after ssa obsoletes it.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



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