RFR: 8295788: C2 compilation hits "assert((mode == ControlAroundStripMined && use == sfpt) || !use->is_reachable_from_root()) failed: missed a node"

Tobias Hartmann thartmann at openjdk.org
Wed Nov 16 06:22:06 UTC 2022


On Tue, 15 Nov 2022 11:42:00 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> This failure is similar to previous failures with loop strip mining: a
> node is encountered that has control set in the outer strip mined loop
> but is not reachable from the safepoint. There's already logic in loop
> cloning to find those and fix their control to be outside the
> loop. Usually a node ends up in the outer loop because some of its
> inputs is in the outer loop. The current logic to catch nodes that are
> erroneously assigned control in the outer loop is to start from
> safepoint's inputs and look for uses with incorrect control. That
> doesn't work in this case because: 1) the node is created by
> IdealLoopTree::reassociate in the outer loop because its inputs are
> indeed there 2) but a pass of split if updates the control to be
> inside the inner loop.
> 
> To fix this, I propose reusing the existing clone_outer_loop_helper()
> but apply it to the loop body as well. I had to tweak that method
> because I ran into cases of dead nodes still reachable from a node in
> the loop body but removed from the _body list by
> IdealLoopTree::DCE_loop_body() (and as a result not cloned).

Looks good to me otherwise.

src/hotspot/share/opto/loopopts.cpp line 2304:

> 2302:     for (uint i = 0; i < loop->_body.size(); i++) {
> 2303:       Node* old = loop->_body.at(i);
> 2304:       clone_outer_loop_helper(old, loop, outer_loop, old_new, wq, this, true);

While you're at it, could you rename the helper method to something more meaningful?

test/hotspot/jtreg/compiler/loopstripmining/TestUseFromInnerInOuterUnusedBySfpt.java line 57:

> 55:     public static void main(String[] strArr) {
> 56:         TestUseFromInnerInOuterUnusedBySfpt _instance = new TestUseFromInnerInOuterUnusedBySfpt();
> 57:         for (int i = 0; i < 10; i++ ) {

Suggestion:

        for (int i = 0; i < 10; i++) {

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

Marked as reviewed by thartmann (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11162


More information about the hotspot-compiler-dev mailing list