[llvm-dev] Fwd: Problem of array index manipulation collection of LLVM IR

Qingkun Meng via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 21 05:07:38 PDT 2016

Hi there,

I am a newbie of llvm and here is my question situation. Assume that there
is a function F which contains a loop named L, a array b[100]. I want to
collect the statistical information of array index operation op(i) (take
add and mul simply) of i in the loop L. Pseudocode lists below.

void F(arg1, arg2){
    int b[100];
    for(int i=0; i<n; i++){
        b[op2(i)]=n2;    // n1 and n2 are just common constants

The code fragment is compiled to LLVM IR, I want to collect how many times
are operations (like add and mul) put on i. However the operations are not
easily obtained because there are many temp variables mix the variable
trace. Does anyone have ideas to solve this or some open source project do
this job?

Thank you very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160721/0cfb2ead/attachment.html>

More information about the llvm-dev mailing list