<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000"><font face="times new roman, new york, times, serif" size="3">Hi All,</font><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">Attached above my InstCount.cpp after modification. I did simple modification which is the following (The statements between the ************** ) :</div><div><div><font face="times new roman, new york, times, serif"><br></font></div><div><span style="font-size: 12pt;">bool InstCount::runOnFunction(Function &F) {</span></div><div><font face="times new roman, new york, times, serif">  unsigned StartMemInsts =</font></div><div><font face="times new roman, new york, times, serif">    NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +</font></div><div><font face="times new roman, new york, times, serif">    NumInvokeInst + NumAllocaInst;</font></div><div><font face="times new roman, new york, times, serif"><br></font></div><div><font face="times new roman, new york, times, serif">//*******************************Omar********</font></div><div><font face="times new roman, new york, times, serif">FILE *f = fopen("omar.txt", "w");</font></div><div><font face="times new roman, new york, times, serif">if (f == NULL)</font></div><div><font face="times new roman, new york, times, serif">{</font></div><div><font face="times new roman, new york, times, serif">    printf("Error opening file!\n");</font></div><div><font face="times new roman, new york, times, serif">    exit(1);</font></div><div><font face="times new roman, new york, times, serif">}</font></div><div><font face="times new roman, new york, times, serif">fprintf(f, "NumGetElementPtrInst: %d\n, NumLoadInst: %d\n,NumStoreInst: %d\n,NumCallInst: %d\n,NumInvokeInst: %d\n,NumAllocaInst: %d\n",NumGetElementPtrInst , NumLoadInst,NumStoreInst,NumCallInst,NumInvokeInst,NumAllocaInst);</font></div><div><font face="times new roman, new york, times, serif">fclose(f);</font></div><div><font face="times new roman, new york, times, serif">//********************************************</font></div><div><font face="times new roman, new york, times, serif">  visit(F);</font></div><div><font face="times new roman, new york, times, serif">  unsigned EndMemInsts =</font></div><div><font face="times new roman, new york, times, serif">    NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +</font></div><div><font face="times new roman, new york, times, serif">    NumInvokeInst + NumAllocaInst;</font></div><div><font face="times new roman, new york, times, serif">  TotalMemInst += EndMemInsts-StartMemInsts;</font></div><div><font face="times new roman, new york, times, serif">  return false;</font></div><div><font face="times new roman, new york, times, serif">}</font></div></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">each time I run instcount pass in different .bc files I got the same results which are  </div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><div style="font-size: 12pt;">NumGetElementPtrInst: 163959956</div><div style="font-size: 12pt;">, NumLoadInst: 163960670</div><div style="font-size: 12pt;">,NumStoreInst: 0</div><div style="font-size: 12pt;">,NumCallInst: 0</div><div style="font-size: 12pt;">,NumInvokeInst: 163959956</div><div style="font-size: 12pt;">,NumAllocaInst: 163960722</div></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">Those numbers are not changed even the bc file changed.</div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">Please:</div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">1- Give me the right way to extract the above information from any c++ source code (attached also the .bc files and their corresponding c++ files) </div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">2-If I changed the InstCount.cpp do I have to make llvm from the scratch or their is a simple way to do the make (where it doesn't take long time just take the minor changes) </div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">3- how can I justify those huge numbers above for simple programs.</div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">Thank you so much for your help.</div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">Please advice me as I told you I am completely new with LLVM and I am really suffering.  </div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><div><br>--Omar</div></div></div></blockquote><style>p { margin: 0; }</style><style>p { margin: 0; }</style></div></body></html>