<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">I think the idea is to model the intrinsic as a normal external function call:</div><div class="gmail_quote">- Can read/write escaped memory</div><div class="gmail_quote">- Escapes pointer args</div><div class="gmail_quote">- Functionattrs cannot infer anything about it</div><div class="gmail_quote">- Returns a pointer which may alias any escaped data</div><div class="gmail_quote"><br></div><div class="gmail_quote">It's obvious how this works at the IR level, but I'm not sure what would happen in the backend. If you compile the intrinsic to nothing but a virtual register copy, MI optimizations will kick in. You might get away with compiling it to a volatile store/load, and hope that the time for high-level memory optimizations like GVN is over.</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Mon, Nov 9, 2015 at 8:58 PM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Nov 9, 2015 at 7:46 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">One thing that volatile doesn't do is escape results that have been written to memory.</div><div class="gmail_extra"><br></div></div></blockquote><div><br></div></span><div>Honestly, i'd probably rather see attributes or something than this intrinsic.</div><div><br></div><div>That said ....</div><span class=""><div> </div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"></div><div class="gmail_extra">The proposed blackbox intrinsic is modeled as reading and writing any pointed to memory, which is useful.</div><div class="gmail_extra"><br></div></div></blockquote><div><br></div></span><div>The proposed intrinsic does not have a really well defined exact set of semantics.</div><div>If it did, and those semantics made sense, i think you'd see a lot less pushback.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"></div><div class="gmail_extra">I also think blackbox will be a lot easier for people to use than empty volatile inline asm and volatile loads and stores. That alone seems worth something. :)</div><div class="gmail_extra"><br></div></div></blockquote><div><br></div></span><div>Yes, but at the same time, it seems very "Do What I Mean".</div><div><br>Those kinds of intrinsics rarely turn out to be sane and maintainable ;-)</div><div><br></div></div></div></div>
</blockquote></div><br></div></div>