<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-03-20 22:14 GMT+01:00 Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.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">Sounds like it works!<div><br></div><div>Basically, adding these extra strip.invariant.group calls before pointer comparisons breaks the transform that was problematic. Presumably, clang would only strip invariant groups from pointers to dynamic types before casting them or using them in a comparison, so that the value equivalence optimization still works in the general case. The proposal trades value equivalence power for more devirtualization power.</div><div><br></div></div></blockquote><div>If optimizer was able to infer some equivalence of pointers before, it should be also able to do it right now, and that is thanks to the strip.invariant.group semantics. Compared to previous proposal, we do not get any more devirtualization</div><div>power (assuming we didn't care about the full correctness) and hopefully we do not loose any other optimizations. But ofc comparing to the -O2 we definitelly get more devirtualization :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>One downside is that it may add many new IR instructions, but I don't see how to avoid them, as the whole point is to create distinct Value objects for use in the pointer equality comparison.</div><span class=""><br></span></div></blockquote><div>That is correct, we do get more instructions (especially that the calls to {strip,launder}.invariant.group usually need to have bitcast to i8* and back from i8*) and I also don't see how we could avoid them (exept unifying pointer types which I hope will happen some day), but the good part is that because of the semantics of strip (especially readnone attribute) the optimizer should be able to CSE all the calls to strip.invariant.group to one.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div class="gmail_quote"><div dir="ltr">On Mon, Mar 19, 2018 at 4:31 PM Piotr Padlewski via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi folks,<div><br></div><div>here is a link to the proposal that we've been working on lately:</div><div><a href="https://docs.google.com/document/d/16GVtCpzK8sIHNc2qZz6RN8amICNBtvjWUod2SujZVEo/edit?usp=sharing" target="_blank">https://docs.google.com/<wbr>document/d/<wbr>16GVtCpzK8sIHNc2qZz6RN8amICNBt<wbr>vjWUod2SujZVEo/edit?usp=<wbr>sharing</a></div></div></blockquote></div></span></div>
</blockquote></div><br></div></div>