1.1 --- a/src/share/vm/opto/loopnode.cpp Sat Oct 24 16:18:50 2020 +0800 1.2 +++ b/src/share/vm/opto/loopnode.cpp Sat Oct 24 16:43:47 2020 +0800 1.3 @@ -3282,6 +3282,41 @@ 1.4 return LCA; 1.5 } 1.6 1.7 +// Check the shape of the graph at the loop entry. In some cases, 1.8 +// the shape of the graph does not match the shape outlined below. 1.9 +// That is caused by the Opaque1 node "protecting" the shape of 1.10 +// the graph being removed by, for example, the IGVN performed 1.11 +// in PhaseIdealLoop::build_and_optimize(). 1.12 +// 1.13 +// After the Opaque1 node has been removed, optimizations (e.g., split-if, 1.14 +// loop unswitching, and IGVN, or a combination of them) can freely change 1.15 +// the graph's shape. As a result, the graph shape outlined below cannot 1.16 +// be guaranteed anymore. 1.17 +bool PhaseIdealLoop::is_canonical_main_loop_entry(CountedLoopNode* cl) { 1.18 + assert(cl->is_main_loop(), "check should be applied to main loops"); 1.19 + Node* ctrl = cl->in(LoopNode::EntryControl); 1.20 + if (ctrl == NULL || (!ctrl->is_IfTrue() && !ctrl->is_IfFalse())) { 1.21 + return false; 1.22 + } 1.23 + Node* iffm = ctrl->in(0); 1.24 + if (iffm == NULL || !iffm->is_If()) { 1.25 + return false; 1.26 + } 1.27 + Node* bolzm = iffm->in(1); 1.28 + if (bolzm == NULL || !bolzm->is_Bool()) { 1.29 + return false; 1.30 + } 1.31 + Node* cmpzm = bolzm->in(1); 1.32 + if (cmpzm == NULL || !cmpzm->is_Cmp()) { 1.33 + return false; 1.34 + } 1.35 + Node* opqzm = cmpzm->in(2); 1.36 + if (opqzm == NULL || opqzm->Opcode() != Op_Opaque1) { 1.37 + return false; 1.38 + } 1.39 + return true; 1.40 +} 1.41 + 1.42 //------------------------------get_late_ctrl---------------------------------- 1.43 // Compute latest legal control. 1.44 Node *PhaseIdealLoop::get_late_ctrl( Node *n, Node *early ) {