<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 31, 2015, at 11:54 AM, Reid Kleckner <<a href="mailto:rnk@google.com" class="">rnk@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I think the easiest path forward is to keep getPersonalityFn returning a Constant and make this a dyn_cast. </div></div></blockquote>Thats totally fine with me.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">I'm halfway done with fixing it.</div></div></blockquote>Thats great, thanks!</div><div><br class=""></div><div>Pete<br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Aug 31, 2015 at 11:19 AM, David Blaikie via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">+Majnemer, since he's been mucking about with this stuff recently</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Aug 31, 2015 at 11:14 AM, Pete Cooper <span dir="ltr" class=""><<a href="mailto:peter_cooper@apple.com" target="_blank" class="">peter_cooper@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">(Moving to LLVM-dev). I hope thats ok to just move the conversation over from commits.</div><div class=""><br class=""></div><div class="">To summarise, selection DAG crashes if personality functions are not actually functions. This conversation is to try work out if that is a restriction we want to document in LangRef, or (as David B suggests), we should allow opaque values to be personality functions. I don’t actually know EH code at all, so I don’t know what the right answer is.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Aug 31, 2015, at 11:06 AM, Philip Reames <<a href="mailto:listmail@philipreames.com" target="_blank" class="">listmail@philipreames.com</a>> wrote:</div><br class=""><div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<div class="">I think this question should be moved
to llvm-dev. </div></div></div></blockquote>Yep, makes sense.<br class=""><blockquote type="cite" class=""><div class=""><div text="#000000" bgcolor="#FFFFFF" class=""><div class="">David's point is completely reasonable, but I think
we generally assume personality functions are functions today.
I'd be tempted to modify the verifier as Pete suggests, but we
should get broader input before actually doing so. Given how
vague the LangRef is today, restricting personality functions to
be direct calls could be construed as a LangRef change.<br class=""></div></div></div></blockquote>Yeah, this is a little vague. Considering the code in SelectionDAGBuilder will always crash if we have a non-Function*, I believe that means we could never have actually codegen-ed any of the code I had to fix in test cases.</div><div class=""><br class=""></div><div class="">...<br class=""><blockquote type="cite" class=""><div class=""><div text="#000000" bgcolor="#FFFFFF" class=""><div class="">
<br class="">
Philip<br class="">
<br class="">
On 08/29/2015 08:56 AM, David Blaikie wrote:<br class="">
</div>
<blockquote type="cite" class="">
<div dir="ltr" class="">Knowing nothing about any of this stuff, I do find
this a bit surprising - usually values are opaque to their
consumers: they're just a value.<br class=""></div></blockquote></div></div></blockquote>So i actually know nothing about this either. When i originally found the crash, personality functions were still on the LandingPadInst itself.</div><div class=""><br class=""></div><div class="">I agree that typically its fine to be able to use opaque values. Unless we actually have to introspect the personality Function*, eg, for calling conventions, then I think its fine to allow any value. In fact, it looks like classifyEHPersonality was written to support this.</div><div class=""><br class=""></div><div class="">Pete<br class=""><blockquote type="cite" class=""><div class=""><div text="#000000" bgcolor="#FFFFFF" class=""><blockquote type="cite" class=""><div dir="ltr" class="">
<br class="">
(especially with pointer bitcasts (which will go away,
eventually) - if I have a global variable I've put some
executable bytes in and I cast a pointer to that global variable
to a pointer to a function, I would expect that should be
interchangeable...)</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Fri, Aug 28, 2015 at 5:33 PM, Pete
Cooper via llvm-commits <span dir="ltr" class=""><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class=""></a><a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a>></span>
wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hi Philip
<div class=""><br class="">
</div>
<div class="">While reducing a test case with personality
functions, I crashed selection DAG. The reason being
that my personality function was no longer a function.
The relevant code is</div>
<div class=""><br class="">
</div>
<div class=""> MF->getMMI().addPersonality(MBB, cast<Function>(LPadInst->getParent()<br class="">
->getParent()<br class="">
->getPersonalityFn()<br class="">
->stripPointerCasts()));</div>
<div class=""><br class="">
</div>
<div class="">We get different behavior in this code, which is able
to handle non-function personality functions.</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class=""><span style="color:#4f8187" class="">EHPersonality</span> <span style="color:#703daa" class="">llvm</span>::classifyEHPersonality(<span style="color:#bb2ca2" class="">const</span> <span style="color:#4f8187" class="">Value</span> *Pers) {</div>
<div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(49,89,93)" class=""><span class=""> </span><span style="color:#bb2ca2" class="">const</span><span class=""> </span><span style="color:#4f8187" class="">Function</span><span class=""> *F = </span>dyn_cast<span class=""><</span><span style="color:#4f8187" class="">Function</span><span class="">>(Pers-></span>stripPointerCasts<span class="">());</span></div>
<div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo" class="">
<span style="color:#bb2ca2" class="">if</span> (!F)</div>
<div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)" class=""><span class=""> </span><span style="color:#bb2ca2" class="">return</span><span class=""> </span>EHPersonality<span class="">::</span><span style="color:#31595d" class="">Unknown</span><span class="">;</span></div>
</div>
<div class=""><br class="">
</div>
<div class="">And finally, LangRef itself implies that its a
function as it says that we should 'specify what
function to use for exception handling’.</div>
<div class=""><br class="">
</div>
<div class="">So i’m not sure exactly what behavior we want.</div>
<div class=""><br class="">
</div>
<div class="">However, assuming we do want personality functions to
always actually be functions (which was what i
originally thought we wanted), here’s a patch which
teaches the verifier this.</div>
<div class=""><br class="">
</div>
<div class="">Comments welcome, including the possibility that this
is completely wrong and that we do want to support other
values as personalities.</div>
<div class=""><br class="">
</div>
<div class="">Cheers</div>
<span class=""><font color="#888888" class="">
<div class="">Pete</div>
<div class=""><br class="">
</div>
</font></span></div>
<br class="">
<br class="">
_______________________________________________<br class="">
llvm-commits mailing list<br class="">
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank" class="">llvm-commits@lists.llvm.org</a><br class="">
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=BQMDaQ&c=eEvniauFctOgLOKGJOplqw&r=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=osq1cWQ7EmXsSMMetgDarRODQ97erXe70D8IoZAGoTM&s=eMTJOIwzYQF_n2Vl-3YdQp5usXIGF5Xfo1FT82cuyt0&e=" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="">
<br class="">
</blockquote>
</div>
<br class="">
</div>
</blockquote>
<br class="">
</div>
</div></blockquote></div><br class=""></div></blockquote></div><br class=""></div>
</div></div><br class="">_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Ddev&d=BQMFaQ&c=eEvniauFctOgLOKGJOplqw&r=03tkj3107244TlY4t3_hEgkDY-UG6gKwwK0wOUS3qjM&m=JIbhL4u-JuLTiLToW_x2vFZ4ByupGb1cnweGTvp_gdo&s=GiYV0p_8It56gducF46EMR4Ulz7UzDc885kHXIgHhr4&e=" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>