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.