madandas@soe.ucsc.edu

Hello,
I’m trying to find if the access within a loop body is using the loop induction variable, and to get the start and end indices of the loop.

for(int i = start; i < end; i++) { A[i] = 0; }

Let’s say, I want to replace this with a function call ‘zero(A,start, end)’

How can I get the Value for start and end, and see if the index is same as loop induction variable? Assume loop is in loopsimplify form.
I browsed many header files, but could’t figure out.

Thanks in advance!
madan

Hi Madan,

   I'm trying to find if the access within a loop body is using the loop
induction variable, and to get the start and end indices of the loop.
for(int i = start; i < end; i++) { A[i] = 0; }
Let's say, I want to replace this with a function call 'zero(A,start, end)'

check out how lib/Transform/MemCpyOptimizer.cpp does it (this is where LLVM
turns loops like this into a call to memset).

Ciao, Duncan.