This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Prevent -fprofile-arcs and -fbranch-probabilities rtlfrom diverging
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, jh at suse dot cz
- Date: Mon, 15 Mar 2004 13:54:02 +0000
- Subject: Re: [patch] Prevent -fprofile-arcs and -fbranch-probabilities rtlfrom diverging
- Organization: Codesourcery LLC
- References: <20040314162423.GA28990@atrey.karlin.mff.cuni.cz>
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