[LLVMdev] Get the loop trip count variable

Zheng Wang jason.wangz at gmail.com
Mon Apr 5 13:19:11 PDT 2010


I am wondering whether I can get the variable name of loop trip count in LLVM?

For example,

int NUM;


for (int i=0; i<NUM; i++)

How can I get the corresponding variable name for "NUM"? Then, I can
instrument something in the source code to record the loop trip count
for a given input data set.

BasicBlock* b = L->getHeader();

returns the basicblock of the loop header, but I don't know how to
extract "NUM" from basicblock b.


More information about the llvm-dev mailing list