[LLVMdev] getTripCount and pointers

Anthony Danalis adanalis at eecs.utk.edu
Fri Mar 20 14:32:25 PDT 2009


Hello,

I'm having some trouble with getTripCount() ... again.  In particular  
it fails in the first of the following two examples, although it works  
for the second.  By fails, I mean it returns NULL.

---------- example 1 ----------
test1(int *a, const int *ip) {
   int k;

   for (k = 0; k < ip[2]; ++k) {
         a[k] = (k+11)/(k+2);
   }
}

---------- example 2 ----------
test2(int *a) {
   int k, ip[4];

   vbar(ip, 4, 7);

   for (k = 0; k < ip[2]; ++k) {
         a[k] = (k+11)/(k+2);
   }
}


However, in both cases the trip count is the same and equally  
undecidable, since "vbar()" is an external function.

Note that in each example that is the only code in the file and I am  
running my pass as:
opt -O1 -licm -load ... -mypass < test.bc > /dev/null

Any suggestions?

thanks,
Anthony



More information about the llvm-dev mailing list