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>
On Wed, Apr 8, 2009 at 10:26 AM, Kshitiz Garg <ksh.cseiitk at gmail.com> wrote:> Neither is there a Phinode for aMaybe you need to run mem2reg first? -Eli
You need more than mem2reg, but -O1 will do it for sure. Anthony On Apr 8, 2009, at 2:30 PM, Eli Friedman wrote:> On Wed, Apr 8, 2009 at 10:26 AM, Kshitiz Garg > <ksh.cseiitk at gmail.com> wrote: >> Neither is there a Phinode for a > > Maybe you need to run mem2reg first? > > -Eli > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Thanks Eli. It worked. :) On Thu, Apr 9, 2009 at 12:00 AM, Eli Friedman <eli.friedman at gmail.com>wrote:> On Wed, Apr 8, 2009 at 10:26 AM, Kshitiz Garg <ksh.cseiitk at gmail.com> > wrote: > > Neither is there a Phinode for a > > Maybe you need to run mem2reg first? > > -Eli > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- 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/20090409/e9264b51/attachment.html>