<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 14, 2017 at 6:25 AM, Michael Kruse <span dir="ltr"><<a href="mailto:llvm-commits@meinersbur.de" target="_blank">llvm-commits@meinersbur.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2017-03-14 0:18 GMT+01:00 Daniel Berlin via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>>:<br>
<span class="">> BTW, note one further thing in your investigate.<br>
> Jikes, at least, would not handle this case.<br>
><br>
> It's a compile-time error in java to have unreachable code.<br>
> Additionally if i remember the JLS properly, the only statement that is<br>
> allowed to not return is "throw"<br>
> Otherwise, everything else generally is may-return, and so, should already<br>
> have the fake edges to exit anyway, they need them even outside the post-dom<br>
> tree.<br>
><br>
> there are detailed rules at the JLS spec 14.21:<br>
> <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.21" rel="noreferrer" target="_blank">http://docs.oracle.com/javase/<wbr>specs/jls/se7/html/jls-14.<wbr>html#jls-14.21</a><br>
><br>
> I would expect hotspot would be the same.<br>
<br>
</span>As far as I can see the discussion is about infinite loops without an<br>
edge to the exit, not unreachable code. </blockquote><div><br></div><div>It is about reverse-unreachable code, which is about whether code may return or not.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It is perfectly fine in Java<br>
to write<br>
<br>
  while (true) {}<br>
<br></blockquote><div><br>Yes </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
but no code is allowed after that infinite loop, it would be<br>
unreachable. </blockquote><div>Correct.</div><div><br></div><div>In such case, this current edge will be connected to exit block and it will assume no code can exist.</div><div>If it is not a constant true/false condition, it will be assumed it can complete normally, and that execution can continue.</div><div><br></div><div>Note: I checked :)</div><div><br></div></div></div></div>