< prev index next >

src/share/vm/opto/loopopts.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


 217   set_ctrl(con, C->root()); // Constant gets a new use
 218   // Hack the dominated test
 219   _igvn.replace_input_of(iff, 1, con);
 220 
 221   // If I dont have a reachable TRUE and FALSE path following the IfNode then
 222   // I can assume this path reaches an infinite loop.  In this case it's not
 223   // important to optimize the data Nodes - either the whole compilation will
 224   // be tossed or this path (and all data Nodes) will go dead.
 225   if (iff->outcnt() != 2) return;
 226 
 227   // Make control-dependent data Nodes on the live path (path that will remain
 228   // once the dominated IF is removed) become control-dependent on the
 229   // dominating projection.
 230   Node* dp = iff->as_If()->proj_out(pop == Op_IfTrue);
 231 
 232   // Loop predicates may have depending checks which should not
 233   // be skipped. For example, range check predicate has two checks
 234   // for lower and upper bounds.
 235   ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp->as_Proj()->_con)->as_Proj();
 236   if (exclude_loop_predicate &&
 237       (is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_predicate) ||
 238        is_uncommon_trap_proj(unc_proj, Deoptimization::Reason_range_check))) {
 239     // If this is a range check (IfNode::is_range_check), do not
 240     // reorder because Compile::allow_range_check_smearing might have
 241     // changed the check.
 242     return; // Let IGVN transformation change control dependence.
 243   }
 244 
 245   IdealLoopTree *old_loop = get_loop(dp);
 246 
 247   for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
 248     Node* cd = dp->fast_out(i); // Control-dependent node
 249     if (cd->depends_only_on_test()) {
 250       assert(cd->in(0) == dp, "");
 251       _igvn.replace_input_of(cd, 0, prevdom);
 252       set_early_ctrl(cd);
 253       IdealLoopTree *new_loop = get_loop(get_ctrl(cd));
 254       if (old_loop != new_loop) {
 255         if (!old_loop->_child) old_loop->_body.yank(cd);
 256         if (!new_loop->_child) new_loop->_body.push(cd);
 257       }
 258       --i;




 217   set_ctrl(con, C->root()); // Constant gets a new use
 218   // Hack the dominated test
 219   _igvn.replace_input_of(iff, 1, con);
 220 
 221   // If I dont have a reachable TRUE and FALSE path following the IfNode then
 222   // I can assume this path reaches an infinite loop.  In this case it's not
 223   // important to optimize the data Nodes - either the whole compilation will
 224   // be tossed or this path (and all data Nodes) will go dead.
 225   if (iff->outcnt() != 2) return;
 226 
 227   // Make control-dependent data Nodes on the live path (path that will remain
 228   // once the dominated IF is removed) become control-dependent on the
 229   // dominating projection.
 230   Node* dp = iff->as_If()->proj_out(pop == Op_IfTrue);
 231 
 232   // Loop predicates may have depending checks which should not
 233   // be skipped. For example, range check predicate has two checks
 234   // for lower and upper bounds.
 235   ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp->as_Proj()->_con)->as_Proj();
 236   if (exclude_loop_predicate &&
 237       (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) ||
 238        unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_range_check))) {
 239     // If this is a range check (IfNode::is_range_check), do not
 240     // reorder because Compile::allow_range_check_smearing might have
 241     // changed the check.
 242     return; // Let IGVN transformation change control dependence.
 243   }
 244 
 245   IdealLoopTree *old_loop = get_loop(dp);
 246 
 247   for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
 248     Node* cd = dp->fast_out(i); // Control-dependent node
 249     if (cd->depends_only_on_test()) {
 250       assert(cd->in(0) == dp, "");
 251       _igvn.replace_input_of(cd, 0, prevdom);
 252       set_early_ctrl(cd);
 253       IdealLoopTree *new_loop = get_loop(get_ctrl(cd));
 254       if (old_loop != new_loop) {
 255         if (!old_loop->_child) old_loop->_body.yank(cd);
 256         if (!new_loop->_child) new_loop->_body.push(cd);
 257       }
 258       --i;


< prev index next >