@@ -4459,6 +4459,7 @@ void PhaseIdealLoop::build_and_optimize() {
44594459 NOT_PRODUCT ( C->verify_graph_edges (); )
44604460 worklist.push (C->top ());
44614461 build_loop_late ( visited, worklist, nstack );
4462+ if (C->failing ()) { return ; }
44624463
44634464 if (_verify_only) {
44644465 C->restore_major_progress (old_progress);
@@ -5991,6 +5992,7 @@ void PhaseIdealLoop::build_loop_late( VectorSet &visited, Node_List &worklist, N
59915992 } else {
59925993 // All of n's children have been processed, complete post-processing.
59935994 build_loop_late_post (n);
5995+ if (C->failing ()) { return ; }
59945996 if (nstack.is_empty ()) {
59955997 // Finished all nodes on stack.
59965998 // Process next node on the worklist.
@@ -6137,13 +6139,15 @@ void PhaseIdealLoop::build_loop_late_post_work(Node *n, bool pinned) {
61376139 Node *legal = LCA; // Walk 'legal' up the IDOM chain
61386140 Node *least = legal; // Best legal position so far
61396141 while ( early != legal ) { // While not at earliest legal
6140- #ifdef ASSERT
61416142 if (legal->is_Start () && !early->is_Root ()) {
6143+ #ifdef ASSERT
61426144 // Bad graph. Print idom path and fail.
61436145 dump_bad_graph (" Bad graph detected in build_loop_late" , n, early, LCA);
61446146 assert (false , " Bad graph detected in build_loop_late" );
6145- }
61466147#endif
6148+ C->record_method_not_compilable (" Bad graph detected in build_loop_late" );
6149+ return ;
6150+ }
61476151 // Find least loop nesting depth
61486152 legal = idom (legal); // Bump up the IDOM tree
61496153 // Check for lower nesting depth
0 commit comments