< prev index next >

src/share/vm/opto/ifnode.cpp

Print this page
rev 5783 : 8024069: replace_in_map() should operate on parent maps
Summary: type information gets lost because replace_in_map() doesn't update parent maps
Reviewed-by: kvn, twisti


1063   // Replace dominated IfNode
1064   dominated_by( prev_dom, igvn );
1065 
1066   // Must return either the original node (now dead) or a new node
1067   // (Do not return a top here, since that would break the uniqueness of top.)
1068   return new (phase->C) ConINode(TypeInt::ZERO);
1069 }
1070 
1071 //------------------------------dominated_by-----------------------------------
1072 void IfNode::dominated_by( Node *prev_dom, PhaseIterGVN *igvn ) {
1073   igvn->hash_delete(this);      // Remove self to prevent spurious V-N
1074   Node *idom = in(0);
1075   // Need opcode to decide which way 'this' test goes
1076   int prev_op = prev_dom->Opcode();
1077   Node *top = igvn->C->top(); // Shortcut to top
1078 
1079   // Loop predicates may have depending checks which should not
1080   // be skipped. For example, range check predicate has two checks
1081   // for lower and upper bounds.
1082   ProjNode* unc_proj = proj_out(1 - prev_dom->as_Proj()->_con)->as_Proj();
1083   if (PhaseIdealLoop::is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate))
1084     prev_dom = idom;
1085 
1086   // Now walk the current IfNode's projections.
1087   // Loop ends when 'this' has no more uses.
1088   for (DUIterator_Last imin, i = last_outs(imin); i >= imin; --i) {
1089     Node *ifp = last_out(i);     // Get IfTrue/IfFalse
1090     igvn->add_users_to_worklist(ifp);
1091     // Check which projection it is and set target.
1092     // Data-target is either the dominating projection of the same type
1093     // or TOP if the dominating projection is of opposite type.
1094     // Data-target will be used as the new control edge for the non-CFG
1095     // nodes like Casts and Loads.
1096     Node *data_target = (ifp->Opcode() == prev_op) ? prev_dom : top;
1097     // Control-target is just the If's immediate dominator or TOP.
1098     Node *ctrl_target = (ifp->Opcode() == prev_op) ?     idom : top;
1099 
1100     // For each child of an IfTrue/IfFalse projection, reroute.
1101     // Loop ends when projection has no more uses.
1102     for (DUIterator_Last jmin, j = ifp->last_outs(jmin); j >= jmin; --j) {
1103       Node* s = ifp->last_out(j);   // Get child of IfTrue/IfFalse




1063   // Replace dominated IfNode
1064   dominated_by( prev_dom, igvn );
1065 
1066   // Must return either the original node (now dead) or a new node
1067   // (Do not return a top here, since that would break the uniqueness of top.)
1068   return new (phase->C) ConINode(TypeInt::ZERO);
1069 }
1070 
1071 //------------------------------dominated_by-----------------------------------
1072 void IfNode::dominated_by( Node *prev_dom, PhaseIterGVN *igvn ) {
1073   igvn->hash_delete(this);      // Remove self to prevent spurious V-N
1074   Node *idom = in(0);
1075   // Need opcode to decide which way 'this' test goes
1076   int prev_op = prev_dom->Opcode();
1077   Node *top = igvn->C->top(); // Shortcut to top
1078 
1079   // Loop predicates may have depending checks which should not
1080   // be skipped. For example, range check predicate has two checks
1081   // for lower and upper bounds.
1082   ProjNode* unc_proj = proj_out(1 - prev_dom->as_Proj()->_con)->as_Proj();
1083   if (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate))
1084     prev_dom = idom;
1085 
1086   // Now walk the current IfNode's projections.
1087   // Loop ends when 'this' has no more uses.
1088   for (DUIterator_Last imin, i = last_outs(imin); i >= imin; --i) {
1089     Node *ifp = last_out(i);     // Get IfTrue/IfFalse
1090     igvn->add_users_to_worklist(ifp);
1091     // Check which projection it is and set target.
1092     // Data-target is either the dominating projection of the same type
1093     // or TOP if the dominating projection is of opposite type.
1094     // Data-target will be used as the new control edge for the non-CFG
1095     // nodes like Casts and Loads.
1096     Node *data_target = (ifp->Opcode() == prev_op) ? prev_dom : top;
1097     // Control-target is just the If's immediate dominator or TOP.
1098     Node *ctrl_target = (ifp->Opcode() == prev_op) ?     idom : top;
1099 
1100     // For each child of an IfTrue/IfFalse projection, reroute.
1101     // Loop ends when projection has no more uses.
1102     for (DUIterator_Last jmin, j = ifp->last_outs(jmin); j >= jmin; --j) {
1103       Node* s = ifp->last_out(j);   // Get child of IfTrue/IfFalse


< prev index next >