This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
does #pragma GCC optimize work with gcc 4.9.2 LTO?
- From: starlight dot 2014q4 at binnacle dot cx
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 24 Nov 2014 14:58:44 -0500
- Subject: does #pragma GCC optimize work with gcc 4.9.2 LTO?
- Authentication-results: sourceware.org; auth=none
Hello,
Starting to use -flto and have a question.
Have a medium-size program where
the majority of the code runs best
with -O2. However a handful of
functions run _much_ better with -O3.
In the non-LTO approach this is a simple
matter of compiling each module with
the appropriate optimization flag.
With LTO, it appears the link-time
optimizer works at only one level,
either the explicitly chosen one or
the level found in the first .o
Can we use
#pragma GCC push_options
#pragma GCC optimize ("-O3")
function() {}
#pragma GCC pop_options
To obtain the desired mixed-optimization
with -flto?
Is ok if the outcome is not perfectly
the same. In our case the specific
optimization that matter are loop
unrolling, inlining of small functions,
and bit field access optimization.
Working with gcc/g++ 4.9.2 and binutils 2.24.
Thanks