<div>Thanks. <span style="line-height: 1.5;">isFreeCall() works well but for</span></div><div><u><span style="line-height: 1.5;">%call2 = call i32 bitcast (i32 (...)* @free to i32 (i8*)*)(i8* %call1) </span><span style="line-height: 1.5;">nounwind, !dbg !16</span></u></div><div><span style="line-height: 1.5;">So I tried to figure out when the above instruction </span>occurred<span style="line-height: 1.5;">.</span></div><div><span style="line-height: 1.5;">When <stdlib.h> is included,   </span>free(buf2R1); turn into  <u>call void @free(i8* %call1) nounwind, !dbg !16</u></div><div>when I forget to include <span style="line-height: 1.5;"><stdlib.h>, </span><span style="line-height: 1.5;">free(buf2R1); turn into  </span><span style="line-height: 1.5;"><u>%call2 = call i32 bitcast (i32 (...)* @free to i32 (i8*)*)(i8* %call1) nounwind, !dbg !16</u></span></div><div><div>I don't understand why this is happen. Could you explain it for me?</div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>From: </b> "Xi Wang"<xi.wang@gmail.com>;</div><div><b>Date: </b> Mon, Mar 11, 2013 12:24 PM</div><div><b>To: </b> "Jane"<270611649@qq.com>; <wbr></div><div><b>Cc: </b> "llvmdev"<llvmdev@cs.uiuc.edu>; <wbr></div><div><b>Subject: </b> Re: [LLVMdev] How to detect all free() calls</div></div><div><br></div>Try isFreeCall() defined in "llvm/Analysis/MemoryBuiltins.h".<br><br>On Mon, Mar 11, 2013 at 12:17 AM, Jane <270611649@qq.com> wrote:<br>><br>> Hi,<br>>     I'm trying to write a pass to detect all free()/delete() call<br>> instructions in LLVM IR.The method is as follows.<br>>     First I find Call Instructions: CallInst *CI=dyn_cast<CallInst>(&*i);<br>>     then see if the Function name matches:<br>>                         name=CI->getCalledFunction()->getName();<br>> if(name=="_ZdlPv"||name=="_ZdaPv"||name=="free")<br>>     It worked but when  something like this occurs<br>>     %call2 = call i32 bitcast (i32 (...)* @free to i32 (i8*)*)(i8* %call1)<br>> nounwind, !dbg !16<br>>     It seems like a indirect function call and I don't know how to detect<br>> free() in such situation.<br>>     By the way, is there any way that is more convenient to detect all<br>> free()/delete() call instructions in a module except by matching the<br>> function name?<br>><br>> _______________________________________________<br>> LLVM Developers mailing list<br>> LLVMdev@cs.uiuc.edu         http://llvm.cs.uiuc.edu<br>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev<br>><br></div>