RFR: 8271056: C2: "assert(no_dead_loop) failed: dead loop detected" due to cmoving identity

Vladimir Kozlov kvn at openjdk.java.net
Fri Oct 29 23:49:14 UTC 2021


On Fri, 29 Oct 2021 13:02:11 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

> In the testcase, an unsafe cmoving identity is applied in `PhiNode::Identity()` after parsing which replaces a loop phi in a dead loop creating a dead data loop which triggers the assertion. The problem is that `PhiNode::Identity()` assumes that a cmoving identity is always safe because `PhiNode::Ideal()` handles unsafe cases and only leaves safe cases to `PhiNode::Identity()`:
> https://github.com/openjdk/jdk/blob/4c3491bfa5f296b80c56a37cb4fffd6497323ac2/src/hotspot/share/opto/cfgnode.cpp#L2051-L2055
> 
> However, the fix for [JDK-8268883 ](https://github.com/openjdk/jdk17/commit/6d8fc7249a3a1a2350c462f9c4fe38377856392f)added the following additional condition to wait for the region to be processed:
> https://github.com/openjdk/jdk/blob/4c3491bfa5f296b80c56a37cb4fffd6497323ac2/src/hotspot/share/opto/cfgnode.cpp#L2047-L2053
> 
> This skips the process of an unsafe case in `PhiNode::Ideal()` in the testcase. Afterwards, the unsafe case is replaced unconditionally in `PhiNode::Identity()` resulting in a dead data loop.
> 
> I therefore propose to add the same check added in JDK-8268883 to `PhiNode::Identity()` to prevent that.
> 
> Thanks,
> Christian

Looks good. Thanks!

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

Marked as reviewed by kvn (Reviewer).

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


More information about the hotspot-compiler-dev mailing list