[llvm] r296535 - Fix PR 24415 (at least), by making our post-dominator tree behavior sane.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 09:00:33 PDT 2017


On Tue, Mar 14, 2017 at 6:25 AM, Michael Kruse <llvm-commits at meinersbur.de>
wrote:

> 2017-03-14 0:18 GMT+01:00 Daniel Berlin via llvm-commits
> <llvm-commits at lists.llvm.org>:
> > BTW, note one further thing in your investigate.
> > Jikes, at least, would not handle this case.
> >
> > It's a compile-time error in java to have unreachable code.
> > Additionally if i remember the JLS properly, the only statement that is
> > allowed to not return is "throw"
> > Otherwise, everything else generally is may-return, and so, should
> already
> > have the fake edges to exit anyway, they need them even outside the
> post-dom
> > tree.
> >
> > there are detailed rules at the JLS spec 14.21:
> > http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.21
> >
> > I would expect hotspot would be the same.
>
> As far as I can see the discussion is about infinite loops without an
> edge to the exit, not unreachable code.


It is about reverse-unreachable code, which is about whether code may
return or not.


> It is perfectly fine in Java
> to write
>
>   while (true) {}
>
>
Yes

> but no code is allowed after that infinite loop, it would be
> unreachable.

Correct.

In such case, this current edge will be connected to exit block and it will
assume no code can exist.
If it is not a constant true/false condition, it will be assumed it can
complete normally, and that execution can continue.

Note: I checked :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170314/9455d30f/attachment.html>


More information about the llvm-commits mailing list