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]

does #pragma GCC optimize work with gcc 4.9.2 LTO?


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


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