This is the mail archive of the gcc@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: -funswitch-loops not effective?


Andrew Pinski <pinskia@physics.uc.edu> wrote:

>> What I don't quite understand is why in the following testcase,
>> unswitching
>> is happening:
>> 
>> void foo(int);
>> void bar(int);
>> 
>> extern const _Bool flag;
>> 
>> void foobar(int n)
>> {
>>         int i;
>>         for (i=0; i<n; ++i)
>>                 if (flag)
>>                         foo(i);
>>                 else
>>                         bar(i);
>> }
> 
> 
> Because even though flag is const in this TU, but does
> not have to be in a different TU

Is this allowed in C++ too?
-- 
Giovanni Bajo


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