<div dir="ltr">Hi Silviu,<div><br></div><div>The problem is that most of the compiler expects function argument attributes to be the same as call operand attributes. Most of FunctionAttrs is devoted to inferring and adding attributes to function arguments (see most of the code below my change, where it finds nocapture). For varargs, there is no such function argument as the number of call operands are greater than the number of function arguments. There's just no representation for "..." to have attributes in the IR.</div><div><br></div><div>As to why we check for LibFuncs, that's because it's possible to take a variable argument and do whatever you like with it. You could capture it, store it to a global, write over it... In fact, vscanf() does this exactly and writes into its variable arguments.</div><div><br></div><div>James</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 12 Nov 2015 at 16:11 <a href="mailto:silviu.baranga@arm.com">silviu.baranga@arm.com</a> via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">sbaranga added a subscriber: sbaranga.<br>
sbaranga added a comment.<br>
<br>
Hi James,<br>
<br>
Do you know what other parts of the compiler are preventing us from figuring out the readonly/nocapture attributes?<br>
<br>
If we could use the existing infrastructure for this we might get a more general solution (I'm not saying that's possible).<br>
<br>
Cheers,<br>
Silviu<br>
<br>
<br>
================<br>
Comment at: lib/Transforms/IPO/FunctionAttrs.cpp:847<br>
@@ +846,3 @@<br>
+  case LibFunc::vsnprintf:<br>
+    return true;<br>
+  }<br>
----------------<br>
Wouldn't it be enough to have readonly/nocapture? Why do we need to test for library functions?<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D14497" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14497</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>