<div dir="ltr">Can't the GlobalsAA pass figure that out without requiring the annotation ?<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-04 21:54 GMT+01:00 Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><br><div><blockquote type="cite"><div>On Jan 4, 2016, at 12:53 PM, Mehdi Amini via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite"><div><br>On Jan 4, 2016, at 9:55 AM, Amaury SECHET via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-01-04 18:21 GMT+01:00 Philip Reames<span> </span><span dir="ltr"><<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><span><div>On 01/04/2016 07:32 AM, Amaury SECHET wrote:<br></div><blockquote type="cite"><div dir="ltr"><div><div>After a bit more investigation, it turns out that because %0 is stored into %1 (after bitcast) and so %3 may have access to it and clobber it.<br></div></div></div></blockquote></span>Can you give a bit more context?  I'm not sure which of the examples you're talking about.<br><br></div></blockquote><div><br></div><div>Sure. Let's look at<span> </span><a href="http://pastebin.com/K0J9yGq1" target="_blank">http://pastebin.com/K0J9yGq1</a><br><br></div><div>Because of the store line 7, it is assumed that the call line 8 may see %0 and even modify the memory it points to. As a result, it is assumed that the load line 11 may not be eliminated.<br><br></div><div>Which seems actually correct in the general case.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><span><br><blockquote type="cite"><div dir="ltr"><div><div><br></div>After a bit of thought, it is correct in the general case, but definitively something stricter is needed here. Looking at<span> </span><tt><span>inaccessiblememonly</span></tt><span> </span>I'm not sure this is what is needed. What if the memory allocator is defined is the current module ?<br></div></div></blockquote></span>At the moment, inaccessiblememonly would require separate compilation of the allocation function. <span> </span><br><span><blockquote type="cite"><div dir="ltr"><div><br></div>This leads me to conclude this is way more linked to the memory allocation pass than I expected it to be in the first place. Can I ask what you plan to use<span> </span><tt><span>inaccessiblememonly</span></tt><span> </span>for ? Should the semantic be refined to fit the bill better ?<br></div></blockquote></span>Well, I didn't introduce the attribute, so I can't speak for the original intent.  For me, I plan on applying it to some of our out of line allocation functions and other helper routines which modify runtime state, but not java visible state. <span> </span><br><br>If you have specific suggestions for how to refine the semantics, please make them.  Getting the details right is always the hard part.  :)<br><br>You might also consider using a variant of your allocation function which takes a pointer to the global state it needs to modify.  Doing this would allow you to use argmemonly to restrict the aliasing while still allowing whole program optimization.  I haven't tried this in practice, but it seems like it would probably work...<span><br></span></div></blockquote><div><br></div><div>I do not wish to make suggestion before I understand where this is coming from. So far, from what I've collected, use cases are:<br></div><div> - Memory allocation<br></div><div> - Runtime isolation for managed languages.<br></div><div><br></div><div>I have some more though to put into this, but to boot, would that be possible to only use this attribute on method that are declared, but not defined and remove it when merging modules ? It doesn't look like it is necessary to have it when the function may be exposed depending on the way the software is built.<br></div></div></div></div></div></blockquote><div><br></div></div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">We can imagine a function defined in the current module, that does not modify any global, but calls malloc. Could it be inferred the argmemonly?</span></div></blockquote><br></div></span><div>I meant inaccessiblememonly instead of argmemonly…</div><div><br></div><div>— </div><span class="HOEnZb"><font color="#888888"><div>Mehdi</div><div><br></div><br></font></span></div></blockquote></div><br></div>