This is the mail archive of the gcc-help@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: function order optimization


Please keep the mailing list in CC.

On 03/08/13 13:42, alex margolin wrote:
Did you mean "-fprofile-use=path" ? I read about it and it seems it
triggers other optimizations (loop unrolling, branch prediction) but
not the function order. Is this true, or does it optimize function
order as well?

Below is its excerpt from the manual:

Enable profile feedback directed optimizations, and optimizations generally
profitable only with profile feedback available.
The following options are enabled: -fbranch-probabilities, -fvpt,
-funroll-loops, -fpeel-loops, -ftracer, -ftree-vectorize,
ftree-loop-distribute-patterns
By default, GCC emits an error message if the feedback profiles do not
match the source code. This error can be turned into a warning by using
â-Wcoverage-mismatchâ. Note this may result in poorly optimized code.
If path is specified, GCC looks at the path to find the profile feedback data
files. See â-fprofile-dirâ.
The following options control compiler behavior regarding
floating-point arithmetic.
These options trade off between speed and correctness. All must be
specifically enabled.

Take a look at -freorder-functions:
'-freorder-functions'
     Reorder functions in the object file in order to improve code
     locality.  This is implemented by using special subsections
     '.text.hot' for most frequently executed functions and
     '.text.unlikely' for unlikely executed functions.  Reordering is
     done by the linker so object file format must support named
     sections and linker must place them in a reasonable way.

     Also profile feedback must be available to make this option
     effective.  See '-fprofile-arcs' for details.

     Enabled at levels '-O2', '-O3', '-Os'.

There are many profile-related options, and I know little of them, that's
why I directed you to the manual instead of trying to provide a recipe.
But you should be able to improve the results with them.


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