<div dir="ltr">Resending my email because I've sent it from wrong mailbox.<br><div class="gmail_extra"><br><div class="gmail_quote">2015-11-13 0:04 GMT+01:00 Piotr Padlewski <span dir="ltr"><<a href="mailto:piotrekpad@gmail.com" target="_blank">piotrekpad@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">There are another things left:<div>1. Adding check for ubsan to detect UBs caused by inplace new</div><div>2. upgrading GVN to optimize based on !invariant.group across BBs</div><div>3. Adding something like "nocapture-global" that will say that this pointer is not being captured by global, but may be captured for example by returning it from function.</div><div>This thing is important because this is exactly what invariant.group.barrier is doing, and right now, because it is not nocapture, emiting this intransic may remove nocapture from function in which we</div><div>emit invariant.group.barrier.</div><div>4. Fix compile time regression caused by many assume instructions (after constructor call). I don't remember which pass it was, but there was one pice of code that had some huge complexity,</div><div>and we coudn't make it better enough to make this change imperceptible. I am not sure what would be good solution to this - maybe there should be some other assume like intrinsic for </div><div>doing this numbers assumes that we had problem.</div><div>5. Maybe add logic that will remove all invariant.group stuff when doing LTO with module that was not compiled with -fstrict-vtable-pointers.</div><div><br></div><div>Besides the things that Richard said.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Piotr</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-11-12 23:40 GMT+01:00 Richard Smith via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>:<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"><div class="gmail_quote"><span>On Thu, Nov 12, 2015 at 2:24 PM, Geoff Berry via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><p class="MsoNormal">Hi All,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I have a two-part de-virtualization enhancement that I’m considering working on and am looking for any feedback on how feasible it is. The two parts are:<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p><u></u><span>1.<span style="font:7.0pt "Times New Roman""> </span></span><u></u>llvm: Extending inter-procedural SCCP (or some other IPO module pass) to propagate llvm.assume’s across function calls. The basic idea would be to collect the set of assumptions for each argument at each call sight and compute the intersection across all call sites, then duplicate the intersection assumption computations in the callee. The reason I’m starting with SCCP is that it already deals with keeping track of computing when all of a function’s possible call sites are known, as well as merging values in a lattice.</p></div></blockquote></span><div>Given that we use !invariant.group loads when loading vptrs, what additional value do you think you can get from this? An example of a case where you could do better than the current approach of -fstrict-vtable-pointers with this technique would help a lot in understanding this.</div><span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><p><u></u><u></u></p><p><u></u><span>2.<span style="font:7.0pt "Times New Roman""> </span></span><u></u>clang: Emitting llvm.assume vtable load sequences for each global variable with virtual functions referenced inside a function. This is similar to what is currently done for local variables and would produce more vtable load assumptions to be propagated by (1).</p></div></blockquote></span><div>Given that it's valid to placement new another object on top of a global, there are some limits on what we can do here -- we can only emit these assumption loads at places in the code where we know the original vptr is present. For instance, we can do this at any point where we emit a member access or member function call on an object of known dynamic type (whether it's local or global), but we cannot do so when such an object is passed by reference into a function or when its address is taken (those operations don't require the object to be within its lifetime).</div><span><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="#0563C1" vlink="#954F72"><p class="MsoNormal">Related to (2), does anyone know what the status is of enabling clang’s –fstrict-vtable-pointers by default? Are there known issues with this code that would need to be resolved as well?</p></div></blockquote><div><br></div></span><div>There are two known issues:</div><div><br></div><div>1) At the IR level (but not at the object code level), it introduces an ABI break: for LTO, all modules must be built with the same setting of the flag or the necessary invariant barriers may be missing, resulting in incorrect devirtualization in rare cases. (If you try to LTO modules with different settings for the flag, we trap the problem and issue an error.)</div><div><br></div><div>2) Not all optimization passes have been updated to understand @llvm.invariant.group.barrier, and as such, inserting it can sometimes result in a pessimization when optimization passes are unable to correctly reason about it. Thus the flag may degrade performance.</div><div><br></div><div>Plus, of course, it can cause existing code that breaks the language rules to start misbehaving (as with any of the -fstrict-* flags that optimize on UB).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><div lang="EN-US" link="#0563C1" vlink="#954F72"><p class="MsoNormal"><u></u></p><p class="MsoNormal">Thanks,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><div style="border:dashed #2f6fab 1.0pt;padding:12.0pt 12.0pt 12.0pt 12.0pt;background:#f9f9f9"><p class="MsoNormal" style="line-height:15.6pt;background:#f9f9f9;border:none;padding:0in">--<u></u><u></u></p><p class="MsoNormal" style="line-height:15.6pt;background:#f9f9f9;border:none;padding:0in">Geoff Berry<u></u><u></u></p><p class="MsoNormal" style="line-height:15.6pt;background:#f9f9f9;border:none;padding:0in">Employee of Qualcomm Innovation Center, Inc.<u></u><u></u></p><p class="MsoNormal" style="line-height:15.6pt;background:#f9f9f9;border:none;padding:0in"> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p></div><br></span>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>