# HG changeset patch # User neliasso # Date 1527005948 -7200 # Tue May 22 18:19:08 2018 +0200 # Node ID ab80eddca92c34a722167dc9f7fee3378f86aa6d # Parent 4befb3c9c75802bf2becaa99defa7110b7bcdb7c 8203425: assert(is_Loop()) failed: invalid node class Reviewed-by: diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -2711,9 +2711,31 @@ if( !_verify_me && !_verify_only && _ltree_root->_child ) { C->print_method(PHASE_BEFORE_BEAUTIFY_LOOPS, 3); if( _ltree_root->_child->beautify_loops( this ) ) { - // IdealLoopTree::split_outer_loop may produce phi-nodes with a single in edge. - // Transform them away. - _igvn.optimize(); + if (_igvn._worklist.size() > orig_worklist_size) { + // IdealLoopTree::split_outer_loop may reduce phi-nodes to loop invariants, + // and we want to get rid of them + _igvn.optimize(); + orig_worklist_size = _igvn._worklist.size(); + + // Re-build loop tree + _ltree_root->_child = NULL; + _nodes.clear(); + reallocate_preorders(); + build_loop_tree(); + + // Check for bailout, and return + if (C->failing()) { + return; + } + + // Reset loop nesting depth + _ltree_root->set_nest( 0 ); + + // The loop structure may have changed - redo beautify loops + C->print_method(PHASE_BEFORE_BEAUTIFY_LOOPS, 3); + _ltree_root->_child->beautify_loops( this ); + C->print_method(PHASE_AFTER_BEAUTIFY_LOOPS, 3); + } // Re-build loop tree! _ltree_root->_child = NULL;