[cfe-dev] One little test, comparing clang and gcc

Chris Lattner clattner at apple.com
Fri Oct 30 09:44:34 PDT 2009


On Oct 30, 2009, at 5:14 AM, Sebastian Redl wrote:

> Mike Stump wrote:
>> On Oct 29, 2009, at 5:38 PM, Giangiacomo Mariotti wrote:
>>
>>> Let's make the example code much shorter:
>>>
>>
>> And even shorter:
>>
>> int n = 50000;
>>
>> int main(void) {
>>   int i, j;
>>   for (i = 1; i <= n; i++) {
>>     for (j = 1; j <= n; j++) {
>>     }
>>   }
>>   return 0;
>> }
>>
>> Please file a PR for this on the website.  Should be trivial enough
>> for them to fix.  Thanks.
>>
> Don't we intentionally *not* optimize out because it's a classical
> delay-loop?

We intentionally do optimize them out.  Consider if this was a generic  
c++ iterator loop who was instantiated on a type with a trivial  
destructor.  We'd want the loop to be nuked.

-Chris



More information about the cfe-dev mailing list