-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
Description
Bugzilla Link | 3328 |
Resolution | FIXED |
Resolved on | May 03, 2010 09:50 |
Version | trunk |
OS | All |
Reporter | LLVM Bugzilla Contributor |
CC | @sunfishcode,@nlewycky |
Extended Description
#include <stdio.h>
#include <stdlib.h>
//
int TESTE ( int parami ,int paraml )
{
int varx=0;
int nI =0;
if( parami > 0 )
{
varx = parami;
}
else
{
varx = 1;
}
for( nI = 1 ; nI <= paraml; nI++) //here
{
varx = varx + parami+ 1;
}
return varx ;
}
int main(int argc, char **argv)
{
if( argc < 3 )
return 0;
return TESTE(atoi(argv[1]),atoi(argv[2]));
}
LLVM should eliminate the loop and do a direct calculation instead.
The MSVC is great in this example and gcc-4.3 also eliminates the loop entirely and directly calculates the value of varx.
It looks like LLVM's scalar evolution code isn't handling your testcase well.