http://llvm.org/bugs/show_bug.cgi?id=3328
Summary: LLVM optmization loop optimization
Product: libraries
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Loop Optimizer
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
#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.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs