<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 04/28/2017 10:22 AM, Piotr Padlewski
via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:CAEhrgAO4_H9_0yhr0=VZ7ucSLsGAVaA2MP9POYSHb3cUNMgaWg@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">Hi,
<div>I have a question about semantics of nocapture attribute:</div>
<div>"<span style="color:rgb(0,0,0);font-family:"lucida
grande","lucida sans
unicode",geneva,verdana,sans-serif;font-size:14px">This
indicates that the callee does not make any copies of the
pointer that outlive the callee itself.</span><span
style="color:rgb(0,0,0);font-family:"lucida
grande","lucida sans
unicode",geneva,verdana,sans-serif;font-size:14px"> "</span></div>
<div><font color="#000000" face="lucida grande, lucida sans
unicode, geneva, verdana, sans-serif"><span
style="font-size:14px">Is returing a pointer considered
outliving callee? For example is this code valid:</span></font></div>
</div>
</blockquote>
<br>
Yes, it includes returning the pointer. The code below is invalid.
The return value outlives the callee itself.<br>
<br>
<blockquote
cite="mid:CAEhrgAO4_H9_0yhr0=VZ7ucSLsGAVaA2MP9POYSHb3cUNMgaWg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><font color="#000000" face="lucida grande, lucida sans
unicode, geneva, verdana, sans-serif"><span
style="font-size:14px"><br>
</span></font></div>
<div><font color="#000000" face="lucida grande, lucida sans
unicode, geneva, verdana, sans-serif"><span
style="font-size:14px">define i8* @foo(i8* nocapture %p)</span></font></div>
<div><font color="#000000" face="lucida grande, lucida sans
unicode, geneva, verdana, sans-serif"><span
style="font-size:14px"> ret i8* %p</span></font></div>
<div><font color="#000000" face="lucida grande, lucida sans
unicode, geneva, verdana, sans-serif"><span
style="font-size:14px">}</span></font></div>
<div><font color="#000000" face="lucida grande, lucida sans
unicode, geneva, verdana, sans-serif"><span
style="font-size:14px"><br>
</span></font></div>
<div><font color="#000000" face="lucida grande, lucida sans
unicode, geneva, verdana, sans-serif"><span
style="font-size:14px">The documentation also mention that
"</span></font><span
style="color:rgb(0,0,0);font-family:"lucida
grande","lucida sans
unicode",geneva,verdana,sans-serif;font-size:14px"> </span><span
style="color:rgb(0,0,0);font-family:"lucida
grande","lucida sans
unicode",geneva,verdana,sans-serif;font-size:14px">This
is not a valid attribute for return values.", but I
interpret that it is is about this case:</span></div>
<div><span style="color:rgb(0,0,0);font-family:"lucida
grande","lucida sans
unicode",geneva,verdana,sans-serif;font-size:14px"><br>
</span></div>
<div>
<div><font color="#000000" face="lucida grande, lucida sans
unicode, geneva, verdana, sans-serif"><span
style="font-size:14px">declare i8* nocapture @bar(i8*
%p)</span></font></div>
</div>
</div>
</blockquote>
<br>
Correct.<br>
<br>
-Hal<br>
<br>
<blockquote
cite="mid:CAEhrgAO4_H9_0yhr0=VZ7ucSLsGAVaA2MP9POYSHb3cUNMgaWg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div><br>
</div>
</div>
<div>Piotr</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>