<div dir="ltr">Thanks Itay for summarizing the discussion on D81911. Directly adding a few folks either involved with the discussion there (Dmitry, who originally ported the gcc implementation to clang/llvm), or who have implemented other patches relating to IFunc support in llvm (Peter).<div><br></div><div>Teresa</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 7, 2020 at 10:07 AM Itay Bookstein via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I was working on <a href="https://reviews.llvm.org/D81911" rel="noreferrer" target="_blank">https://reviews.llvm.org/D81911</a> to try and fix<br>
<a href="https://bugs.llvm.org/show_bug.cgi?id=46340" rel="noreferrer" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=46340</a> . Through the review<br>
process we happened upon a design limitation or perhaps a potential<br>
mis-modelling of GlobalIFunc in the IR object hierarchy, which leads<br>
to some problems in LTO flows.<br>
<br>
To summarize, as it currently stands (and in the hopes of faithfully<br>
representing the conclusions of that discussion):<br>
* Calling getBaseObject() on a GlobalAlias whose aliasee is a<br>
GlobalIFunc currently returns null.<br>
* Calling getBaseObject() on a GlobalIFunc returns its resolver function.<br>
* This causes computeAliasSummary in ModuleSummaryAnalysis to crash on<br>
a null dereference for an alias-to-ifunc situation.<br>
* A GlobalIFunc and its resolver are *not* interchangeable: at the<br>
interface level, they have different signatures (conceptually, the<br>
IFunc has the same signature of the function pointer that the resolver<br>
potentially returns, not of the resolver itself).<br>
* It makes sense for the IFunc to be its own base object (which is<br>
GlobalObject-like-behavior), but type-hierarchy-wise it can't. This is<br>
because GlobalIFunc derives from GlobalIndirectSymbol which derives<br>
directly from GlobalValue, and therefore it is not a GlobalObject.<br>
<br>
Would it make sense for GlobalIFunc to derive from GlobalObject<br>
instead of GlobalIndirectSymbol? If so, GlobalIndirectSymbol would<br>
lose its purpose somewhat, and could be merged into GlobalAlias. It<br>
would, however, require updating a considerable amount of code.<br>
<br>
~Itay<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"><br></td></tr></tbody></table></span></div></div></div>