This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/35544] Error with -fprofile-use
- From: "xinliangli at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Mar 2008 06:20:57 -0000
- Subject: [Bug middle-end/35544] Error with -fprofile-use
- References: <bug-35544-9436@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from xinliangli at gmail dot com 2008-03-13 06:20 -------
(In reply to comment #10)
> Subject: Re: New: Error with -fprofile-use
>
> xinliangli at gmail dot com wrote:
> > In the following example, profile data generated by -O0 binary run can not be
> > used for profile-use at -O2. This is either a bug or design flaw if not
> > supported.
>
> Gcc constructs a minimal spanning tree for the CFG, and then only adds
> instrumentation code to arcs that are not on the minimal spanning tree.
> We can compute arc counts for the rest of the CFG from this set. We
> can compute basic block execution counts from the arc counts. This
> reduces the run-time cost of the instrumentation code, since only a
> small fraction of the basic blocks require profiling code. However, it
> also requires that we have exactly the same CFG with -fprofile-generate
> as we have with -fprofile-use, and hence you must use the same
> optimization options with both compiles.
>
> Jim
>
Gcc's design minimizes runtime overhead for edge profiling -- this is a very
good design. Same CFG is the requirement for other compilers as well, but some
compilers do tolerate some differences even with source some source changes --
this give user the flexibility to use slightly stale profile data while still
getting some performance benefit. Please note that people already hate FDO due
to its complicated steps -- adding more constraints won't help to make them
happy.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35544