[LLVMdev] help using indvars pass

Kshitiz Garg ksh.cseiitk at gmail.com
Wed Apr 8 10:26:21 PDT 2009


I am trying to use the indvars pass on a simple loop but it does not seem to
have any effect
The sample code i am using is

#include <stdio.h>
int test (int p);
int main(){
        int a,b=3;
        for(a=7;a*a<100;++a){
                if(b >3)
                     test(3);
                b++;
        }

return 1;
}
int test(int p){
        return p;
}

According to documentation the loop should get converted to something like

for (a = 0; a != 25; ++a)
 but the generated IR does not reflect this.the loop still goes from 7
to 99. Neither is there a Phinode for a
I am using the following commands

llvm-gcc -emit-llvm -c hello.c

opt -indvars hello.o >hello.bc
llvm-dis hello.bc

Is there something  I am missing?

Thanks,

-- 
Kshitiz Garg
Graduate Student
Department of Computer Science & Engineering
IIT Kanpur
http://home.iitk.ac.in/~kshitizg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090408/1fcb97e2/attachment.html>


More information about the llvm-dev mailing list