@@ -2139,9 +2139,10 @@ SafePointNode* CountedLoopNode::outer_safepoint() const {
2139
2139
}
2140
2140
2141
2141
Node* 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))) {
2145
2146
ctrl = ctrl->in (0 )->in (0 );
2146
2147
}
2147
2148
@@ -4920,28 +4921,34 @@ Node* PhaseIdealLoop::compute_lca_of_uses(Node* n, Node* early, bool verify) {
4920
4921
// loop unswitching, and IGVN, or a combination of them) can freely change
4921
4922
// the graph's shape. As a result, the graph shape outlined below cannot
4922
4923
// 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 ;
4926
4927
}
4927
- Node* ctrl = cl-> skip_predicates ();
4928
+ Node* ctrl = skip_predicates ();
4928
4929
4929
4930
if (ctrl == NULL || (!ctrl->is_IfTrue () && !ctrl->is_IfFalse ())) {
4930
- return false ;
4931
+ return NULL ;
4931
4932
}
4932
4933
Node* iffm = ctrl->in (0 );
4933
4934
if (iffm == NULL || !iffm->is_If ()) {
4934
- return false ;
4935
+ return NULL ;
4935
4936
}
4936
4937
Node* bolzm = iffm->in (1 );
4937
4938
if (bolzm == NULL || !bolzm->is_Bool ()) {
4938
- return false ;
4939
+ return NULL ;
4939
4940
}
4940
4941
Node* cmpzm = bolzm->in (1 );
4941
4942
if (cmpzm == NULL || !cmpzm->is_Cmp ()) {
4942
- return false ;
4943
+ return NULL ;
4943
4944
}
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
4945
4952
bool found_opaque = false ;
4946
4953
for (uint i = 1 ; i < cmpzm->req (); i++) {
4947
4954
Node* opnd = cmpzm->in (i);
@@ -4950,10 +4957,9 @@ bool PhaseIdealLoop::is_canonical_loop_entry(CountedLoopNode* cl) {
4950
4957
break ;
4951
4958
}
4952
4959
}
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 ;
4957
4963
}
4958
4964
4959
4965
// ------------------------------get_late_ctrl----------------------------------
0 commit comments