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

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 06:25:52 PDT 2017


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 perfectly fine in Java
to write

  while (true) {}

but no code is allowed after that infinite loop, it would be
unreachable. I don't know how java computes its postdominator tree.

Michael


More information about the llvm-commits mailing list