diff --git a/src/share/vm/opto/loopUnswitch.cpp b/src/share/vm/opto/loopUnswitch.cpp index fcba517e8b244cef12427b51653b53c1fef156bf..5f384b60b434755fc490d3b7b84313e9f84dba63 100644 --- a/src/share/vm/opto/loopUnswitch.cpp +++ b/src/share/vm/opto/loopUnswitch.cpp @@ -51,6 +51,9 @@ bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const { if( !LoopUnswitching ) { return false; } + if (!_head->is_Loop()) { + return false; + } uint nodes_left = MaxNodeLimit - phase->C->unique(); if (2 * _body.size() > nodes_left) { return false; // Too speculative if running low on nodes. diff --git a/src/share/vm/opto/loopopts.cpp b/src/share/vm/opto/loopopts.cpp index 6535c552907f631c58f973a821ab6e18f4cae512..52dc89266ffc521ed1c58145e01a082ea25b8020 100644 --- a/src/share/vm/opto/loopopts.cpp +++ b/src/share/vm/opto/loopopts.cpp @@ -2257,6 +2257,9 @@ bool PhaseIdealLoop::is_valid_clone_loop_form( IdealLoopTree *loop, Node_List& p // bool PhaseIdealLoop::partial_peel( IdealLoopTree *loop, Node_List &old_new ) { + if (!loop->_head->is_Loop()) { + return false; } + LoopNode *head = loop->_head->as_Loop(); if (head->is_partial_peel_loop() || head->partial_peel_has_failed()) {