Integrated: 8280799: С2: assert(false) failed: cyclic dependency prevents range check elimination

Roland Westrelin roland at openjdk.java.net
Mon Feb 14 08:39:17 UTC 2022


On Wed, 2 Feb 2022 10:38:11 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> The loop exit condition of the test method:
> 
> if (i == stop) {
>     break;
> }
> 
> requires insertion of a loop limit predicate when the loop is turned
> into a counted loop. stop is a LoadI. Next:
> 
> array[stop - i + j] = 0;
> 
> is transformed to:
> 
> array[stop - i] = 0;
> 
> and the range check for that array access becomes candidate for
> predication in a subsequent loop opts pass. stop has control just
> above the loop limit check when that happens (because it is assigned
> control as late as possible). But the loop predicate for the bound
> check needs to be above the loop limit check and that causes the
> assert failure.
> 
> There's already logic in PhaseIdealLoop::build_loop_late_post_work()
> to assign control to nodes above predicates so this sort of issues
> doesn't occur. But it only applies to node initially on the entry
> projection right above the loop head. The fix I propose is to remove
> that restriction.
> 
> That logic was added by JDK-8203197 and looking back at this change I
> noticed I replaced some existing logic with the current logic but,
> while the 2 overlap, the current logic is not guaranteed to always
> cover some cases handled by the old logic. So I resurrected that old
> logic here.
> 
> Finally, when running tests, I hit failures because Opaque nodes for
> skeleton predicates can now end up above a predicate that is split
> thru phi. That causes the Opaque nodes to be split up and breaks
> pattern matching. I'm actually not sure this issue is specific to the
> change here so I think it's best to treat it as a general issue and
> fix it by cloning the chain of nodes that lead to the Opaque node
> down.

This pull request has now been integrated.

Changeset: 1ef45c5b
Author:    Roland Westrelin <roland at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/1ef45c5bbdeb4e1ca65c6d8f3ac1568a6951f3a7
Stats:     340 lines in 3 files changed: 314 ins; 21 del; 5 mod

8280799: С2: assert(false) failed: cyclic dependency prevents range check elimination

Reviewed-by: thartmann, kvn

-------------

PR: https://git.openjdk.java.net/jdk/pull/7319


More information about the hotspot-compiler-dev mailing list