<div>On Wed Jan 15 2014 at 8:41:28 PM, James Stark <<a href="mailto:mrjamesstark@gmail.com">mrjamesstark@gmail.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
My LLVM pass scans call instructions for standard C library calls. For<br>
some libc functions, however, clang uses intrinsics instead. For<br>
example, I see that my memcpy calls are replaced by the llvm.memcpy.*<br>
intrinsics. This is not a problem because I can simply look for<br>
llvm.memcpy calls when scanning for memcpy calls.<br>
<br>
The problem arises when clang implicitly uses llvm.memcpy intrinsics<br>
when it thinks they are needed. In this case, I do not see a single<br>
memcpy call in my source file but its IR does have them. How do I make<br>
a distinction between a real C library call and an intrinsic?<br>
<br>
For example,<br>
<br>
memcpy(buffer, "aa", 1); // clang uses llvm.memcpy for this statement<br>
<br>
char* buffer[] = {"xxx", "yyy"}; // clang also uses llvm.memcpy for<br>
this statement<br></blockquote><div><br></div><div>You can use -fno-builtin to instruct Clang not to treat standard C library functions as having known, built-in semantics.</div>