<div dir="ltr"><div><br></div>Got it, thank you for your perfect answer.<div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><br>--------------------------------------------<br>Qiuping Yi<br>Institute Of Software<br>Chinese Academy of Sciences</div></div>
<br><div class="gmail_quote">On Thu, Jul 16, 2015 at 12:08 PM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> Could you tell me why function "func" with a return value<br>
> is changed to be one with a void return value and another<br>
> more parameter %o. Does "noalias sret" play a special role?<br>
<br>
</span>Have you found the reference page for LLVM IR yet? It describes sret:<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_LangRef.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=YMRcDoNH0e2OouaEECxvuUPPICFmZmDKeVI-yenz2XI&s=Ox1634oespUm5dHla-FuVaeNHF3EHvTCj_pQAKTlacU&e=" rel="noreferrer" target="_blank">http://llvm.org/docs/LangRef.html</a><br>
<span class=""><br>
> What is the exact meaning of "noalias sret"?<br>
<br>
</span>The "sret" (struct-return) is the important one. When a struct gets<br>
too big (as decided by the ABI writers) to be returned directly, what<br>
often happens is that the caller has to allocate storage for the<br>
object and pass this pointer to the function being called.<br>
<br>
Because this demotion is often handled differently from a normal<br>
argument (AArch64 requires register "X8" to be used; as I recall x86<br>
requires the pointer to be re-returned) we need a special argument<br>
attribute to mark this so that the correct code can be generated.<br>
<br>
"noalias" is just an optimisation hint: because of how this argument<br>
came to exist (allocated by the caller directly before the call), no<br>
other pointer accessible to the function can alias it. This allows<br>
some useful transformations in the mid-end.<br>
<br>
Cheers.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>