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: Problem with functions not being inlined


2015-03-02 17:06 GMT-03:00 Andrew Haley <aph@redhat.com>:
> On 03/02/2015 08:04 PM, Andres Tiraboschi wrote:
>>> On 03/02/2015 07:56 PM, Andres Tiraboschi wrote:
>>>> But passing those flags I listed above, why the compiler is not doing
>>>> those optimizations?
>>>
>>> Because you have said -O0.  -O0 means no optimization.
>>>
>>> With -O0, all those other optimization options are ignored.
>>
>> forget -O0, compiling this way I have exactly the same problem:
>> g++ -finline-functions -finline-functions-called-once
>> -finline-small-functions -ftree-coalesce-inlined-vars -Wall -Wextra
>> -pedantic -std=c++11 -Winline main.cpp
>>
>> (is the same but without -O0)
>
> -O0 is the default.
>
> If you want optimization, you have to turn it on.
>
>

but when i put this line:
$ g++ -finline-functions -finline-functions-called-once
-finline-small-functions -ftree-coalesce-inlined-vars -Wall -Wextra
-pedantic -std=c++11 -Winline main.cpp -Q --help=optimizers | grep
"inline"

i get:
  -finline                                    [enabled]
  -finline-atomics                        [enabled]
  -finline-functions                       [enabled]
  -finline-functions-called-once     [enabled]
  -finline-small-functions              [enabled]
  -ftree-coalesce-inlined-vars        [enabled]

So, in theory when I'm compiling that optimizations.


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