@@ -2139,9 +2139,10 @@ SafePointNode* CountedLoopNode::outer_safepoint() const {
21392139}
21402140
21412141Node* CountedLoopNode::skip_predicates_from_entry (Node* ctrl) {
2142- while (ctrl != NULL && ctrl->is_Proj () && ctrl->in (0 )->is_If () &&
2143- ctrl->in (0 )->as_If ()->proj_out (1 -ctrl->as_Proj ()->_con )->outcnt () == 1 &&
2144- ctrl->in (0 )->as_If ()->proj_out (1 -ctrl->as_Proj ()->_con )->unique_out ()->Opcode () == Op_Halt) {
2142+ while (ctrl != NULL && ctrl->is_Proj () && ctrl->in (0 ) != NULL && ctrl->in (0 )->is_If () &&
2143+ (ctrl->in (0 )->as_If ()->proj_out_or_null (1 -ctrl->as_Proj ()->_con ) == NULL ||
2144+ (ctrl->in (0 )->as_If ()->proj_out (1 -ctrl->as_Proj ()->_con )->outcnt () == 1 &&
2145+ ctrl->in (0 )->as_If ()->proj_out (1 -ctrl->as_Proj ()->_con )->unique_out ()->Opcode () == Op_Halt))) {
21452146 ctrl = ctrl->in (0 )->in (0 );
21462147 }
21472148
@@ -4920,28 +4921,34 @@ Node* PhaseIdealLoop::compute_lca_of_uses(Node* n, Node* early, bool verify) {
49204921// loop unswitching, and IGVN, or a combination of them) can freely change
49214922// the graph's shape. As a result, the graph shape outlined below cannot
49224923// be guaranteed anymore.
4923- bool PhaseIdealLoop ::is_canonical_loop_entry (CountedLoopNode* cl ) {
4924- if (!cl-> is_main_loop () && !cl-> is_post_loop ()) {
4925- return false ;
4924+ Node* CountedLoopNode ::is_canonical_loop_entry () {
4925+ if (!is_main_loop () && !is_post_loop ()) {
4926+ return NULL ;
49264927 }
4927- Node* ctrl = cl-> skip_predicates ();
4928+ Node* ctrl = skip_predicates ();
49284929
49294930 if (ctrl == NULL || (!ctrl->is_IfTrue () && !ctrl->is_IfFalse ())) {
4930- return false ;
4931+ return NULL ;
49314932 }
49324933 Node* iffm = ctrl->in (0 );
49334934 if (iffm == NULL || !iffm->is_If ()) {
4934- return false ;
4935+ return NULL ;
49354936 }
49364937 Node* bolzm = iffm->in (1 );
49374938 if (bolzm == NULL || !bolzm->is_Bool ()) {
4938- return false ;
4939+ return NULL ;
49394940 }
49404941 Node* cmpzm = bolzm->in (1 );
49414942 if (cmpzm == NULL || !cmpzm->is_Cmp ()) {
4942- return false ;
4943+ return NULL ;
49434944 }
4944- // compares can get conditionally flipped
4945+
4946+ uint input = is_main_loop () ? 2 : 1 ;
4947+ if (input >= cmpzm->req () || cmpzm->in (input) == NULL ) {
4948+ return NULL ;
4949+ }
4950+ bool res = cmpzm->in (input)->Opcode () == Op_Opaque1;
4951+ #ifdef ASSERT
49454952 bool found_opaque = false ;
49464953 for (uint i = 1 ; i < cmpzm->req (); i++) {
49474954 Node* opnd = cmpzm->in (i);
@@ -4950,10 +4957,9 @@ bool PhaseIdealLoop::is_canonical_loop_entry(CountedLoopNode* cl) {
49504957 break ;
49514958 }
49524959 }
4953- if (!found_opaque) {
4954- return false ;
4955- }
4956- return true ;
4960+ assert (found_opaque == res, " wrong pattern" );
4961+ #endif
4962+ return res ? cmpzm->in (input) : NULL ;
49574963}
49584964
49594965// ------------------------------get_late_ctrl----------------------------------
0 commit comments