992 return NULL; 993 } 994 #endif 995 996 // Replace dominated IfNode 997 dominated_by( prev_dom, igvn ); 998 999 // Must return either the original node (now dead) or a new node 1000 // (Do not return a top here, since that would break the uniqueness of top.) 1001 return new (phase->C, 1) ConINode(TypeInt::ZERO); 1002 } 1003 1004 //------------------------------dominated_by----------------------------------- 1005 void IfNode::dominated_by( Node *prev_dom, PhaseIterGVN *igvn ) { 1006 igvn->hash_delete(this); // Remove self to prevent spurious V-N 1007 Node *idom = in(0); 1008 // Need opcode to decide which way 'this' test goes 1009 int prev_op = prev_dom->Opcode(); 1010 Node *top = igvn->C->top(); // Shortcut to top 1011 1012 // Now walk the current IfNode's projections. 1013 // Loop ends when 'this' has no more uses. 1014 for (DUIterator_Last imin, i = last_outs(imin); i >= imin; --i) { 1015 Node *ifp = last_out(i); // Get IfTrue/IfFalse 1016 igvn->add_users_to_worklist(ifp); 1017 // Check which projection it is and set target. 1018 // Data-target is either the dominating projection of the same type 1019 // or TOP if the dominating projection is of opposite type. 1020 // Data-target will be used as the new control edge for the non-CFG 1021 // nodes like Casts and Loads. 1022 Node *data_target = (ifp->Opcode() == prev_op ) ? prev_dom : top; 1023 // Control-target is just the If's immediate dominator or TOP. 1024 Node *ctrl_target = (ifp->Opcode() == prev_op ) ? idom : top; 1025 1026 // For each child of an IfTrue/IfFalse projection, reroute. 1027 // Loop ends when projection has no more uses. 1028 for (DUIterator_Last jmin, j = ifp->last_outs(jmin); j >= jmin; --j) { 1029 Node* s = ifp->last_out(j); // Get child of IfTrue/IfFalse 1030 igvn->hash_delete(s); // Yank from hash table before edge hacking 1031 if( !s->depends_only_on_test() ) { 1032 // Find the control input matching this def-use edge. 1033 // For Regions it may not be in slot 0. 1034 uint l; 1035 for( l = 0; s->in(l) != ifp; l++ ) { } 1036 s->set_req(l, ctrl_target); 1037 } else { // Else, for control producers, 1038 s->set_req(0, data_target); // Move child to data-target 1039 } 1040 igvn->_worklist.push(s); // Revisit collapsed Phis 1041 } // End for each child of a projection 1042 1043 igvn->remove_dead_node(ifp); 1044 } // End for each IfTrue/IfFalse child of If | 992 return NULL; 993 } 994 #endif 995 996 // Replace dominated IfNode 997 dominated_by( prev_dom, igvn ); 998 999 // Must return either the original node (now dead) or a new node 1000 // (Do not return a top here, since that would break the uniqueness of top.) 1001 return new (phase->C, 1) ConINode(TypeInt::ZERO); 1002 } 1003 1004 //------------------------------dominated_by----------------------------------- 1005 void IfNode::dominated_by( Node *prev_dom, PhaseIterGVN *igvn ) { 1006 igvn->hash_delete(this); // Remove self to prevent spurious V-N 1007 Node *idom = in(0); 1008 // Need opcode to decide which way 'this' test goes 1009 int prev_op = prev_dom->Opcode(); 1010 Node *top = igvn->C->top(); // Shortcut to top 1011 1012 // Loop predicates may have depending checks which should not 1013 // be skipped. For example, range check predicate has two checks 1014 // for lower and upper bounds. 1015 ProjNode* unc_proj = proj_out(1 - prev_dom->as_Proj()->_con)->as_Proj(); 1016 if (PhaseIdealLoop::is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate)) 1017 prev_dom = idom; 1018 1019 // Now walk the current IfNode's projections. 1020 // Loop ends when 'this' has no more uses. 1021 for (DUIterator_Last imin, i = last_outs(imin); i >= imin; --i) { 1022 Node *ifp = last_out(i); // Get IfTrue/IfFalse 1023 igvn->add_users_to_worklist(ifp); 1024 // Check which projection it is and set target. 1025 // Data-target is either the dominating projection of the same type 1026 // or TOP if the dominating projection is of opposite type. 1027 // Data-target will be used as the new control edge for the non-CFG 1028 // nodes like Casts and Loads. 1029 Node *data_target = (ifp->Opcode() == prev_op) ? prev_dom : top; 1030 // Control-target is just the If's immediate dominator or TOP. 1031 Node *ctrl_target = (ifp->Opcode() == prev_op) ? idom : top; 1032 1033 // For each child of an IfTrue/IfFalse projection, reroute. 1034 // Loop ends when projection has no more uses. 1035 for (DUIterator_Last jmin, j = ifp->last_outs(jmin); j >= jmin; --j) { 1036 Node* s = ifp->last_out(j); // Get child of IfTrue/IfFalse 1037 igvn->hash_delete(s); // Yank from hash table before edge hacking 1038 if( !s->depends_only_on_test() ) { 1039 // Find the control input matching this def-use edge. 1040 // For Regions it may not be in slot 0. 1041 uint l; 1042 for( l = 0; s->in(l) != ifp; l++ ) { } 1043 s->set_req(l, ctrl_target); 1044 } else { // Else, for control producers, 1045 s->set_req(0, data_target); // Move child to data-target 1046 } 1047 igvn->_worklist.push(s); // Revisit collapsed Phis 1048 } // End for each child of a projection 1049 1050 igvn->remove_dead_node(ifp); 1051 } // End for each IfTrue/IfFalse child of If |