<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 12, 2021 at 12:47 AM Jeroen Dobbelaere via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi all,<br>
<br>
I have found a case where an optimization pass is barfing on invalid code in an unreachable<br>
basic block. A self referencing GEP '%x = getelementptr %x, 0, 1' is found inside a cycle of<br>
two unreachable basic blocks)<br>
<br>
The invalid code and the unreachable basic blocks were introduced by the function inliner.<br>
<br>
I am wondering what is valid for these cases ?<br>
(I did not find anything in LangRef, but I might as well have missed it)<br>
<br>
- clearly 'dead code' (aka unreachable basic blocks) is valid in an IR ?<br>
- I assume that the self reference in dead code is not valid ?<br></blockquote><div><br></div><div>Yes, self-references are valid in unreachable code, we have test cases for this, it'll pass the verifier. Passes should be resilient against this (even though a pass could always do a quick reachability check and delete all dead blocks as a pre-step).</div><div><br></div><div>-- </div><div>Mehdi</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
- should inlining do an extra effort of cleaning up such dead code blocks ?<br>
<br>
Thanks,<br>
<br>
Jeroen Dobbelaere<br>
<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></div>