comparison src/share/vm/opto/cfgnode.cpp @ 1621:6027dddc26c6

6677629: PhaseIterGVN::subsume_node() should call hash_delete() and add_users_to_worklist() Summary: Use replace_node() method instead of subsume_node(). Reviewed-by: jrose, never
author kvn
date Mon, 28 Jun 2010 14:54:39 -0700
parents c18cbe5936b8
children f95d63e2154a
comparison
equal deleted inserted replaced
1620:d678e3277048 1621:6027dddc26c6
470 if( n->is_Phi() ) { 470 if( n->is_Phi() ) {
471 assert( igvn->eqv(n->in(0), this), "" ); 471 assert( igvn->eqv(n->in(0), this), "" );
472 assert( n->req() == 2 && n->in(1) != NULL, "Only one data input expected" ); 472 assert( n->req() == 2 && n->in(1) != NULL, "Only one data input expected" );
473 // Break dead loop data path. 473 // Break dead loop data path.
474 // Eagerly replace phis with top to avoid phis copies generation. 474 // Eagerly replace phis with top to avoid phis copies generation.
475 igvn->add_users_to_worklist(n); 475 igvn->replace_node(n, top);
476 igvn->hash_delete(n); // Yank from hash before hacking edges
477 igvn->subsume_node(n, top);
478 if( max != outcnt() ) { 476 if( max != outcnt() ) {
479 progress = true; 477 progress = true;
480 j = refresh_out_pos(j); 478 j = refresh_out_pos(j);
481 max = outcnt(); 479 max = outcnt();
482 } 480 }
516 for (DUIterator_Last imin, i = last_outs(imin); i >= imin; --i) { 514 for (DUIterator_Last imin, i = last_outs(imin); i >= imin; --i) {
517 Node* n = last_out(i); 515 Node* n = last_out(i);
518 igvn->hash_delete(n); // Remove from worklist before modifying edges 516 igvn->hash_delete(n); // Remove from worklist before modifying edges
519 if( n->is_Phi() ) { // Collapse all Phis 517 if( n->is_Phi() ) { // Collapse all Phis
520 // Eagerly replace phis to avoid copies generation. 518 // Eagerly replace phis to avoid copies generation.
521 igvn->add_users_to_worklist(n); 519 Node* in;
522 igvn->hash_delete(n); // Yank from hash before hacking edges
523 if( cnt == 0 ) { 520 if( cnt == 0 ) {
524 assert( n->req() == 1, "No data inputs expected" ); 521 assert( n->req() == 1, "No data inputs expected" );
525 igvn->subsume_node(n, parent_ctrl); // replaced by top 522 in = parent_ctrl; // replaced by top
526 } else { 523 } else {
527 assert( n->req() == 2 && n->in(1) != NULL, "Only one data input expected" ); 524 assert( n->req() == 2 && n->in(1) != NULL, "Only one data input expected" );
528 Node* in1 = n->in(1); // replaced by unique input 525 in = n->in(1); // replaced by unique input
529 if( n->as_Phi()->is_unsafe_data_reference(in1) ) 526 if( n->as_Phi()->is_unsafe_data_reference(in) )
530 in1 = phase->C->top(); // replaced by top 527 in = phase->C->top(); // replaced by top
531 igvn->subsume_node(n, in1);
532 } 528 }
529 igvn->replace_node(n, in);
533 } 530 }
534 else if( n->is_Region() ) { // Update all incoming edges 531 else if( n->is_Region() ) { // Update all incoming edges
535 assert( !igvn->eqv(n, this), "Must be removed from DefUse edges"); 532 assert( !igvn->eqv(n, this), "Must be removed from DefUse edges");
536 uint uses_found = 0; 533 uint uses_found = 0;
537 for( uint k=1; k < n->req(); k++ ) { 534 for( uint k=1; k < n->req(); k++ ) {
2125 if (can_reshape && !in(0)->is_Loop()) { 2122 if (can_reshape && !in(0)->is_Loop()) {
2126 // Dead code elimination can sometimes delete this projection so 2123 // Dead code elimination can sometimes delete this projection so
2127 // if it's not there, there's nothing to do. 2124 // if it's not there, there's nothing to do.
2128 Node* fallthru = proj_out(0); 2125 Node* fallthru = proj_out(0);
2129 if (fallthru != NULL) { 2126 if (fallthru != NULL) {
2130 phase->is_IterGVN()->subsume_node(fallthru, in(0)); 2127 phase->is_IterGVN()->replace_node(fallthru, in(0));
2131 } 2128 }
2132 return phase->C->top(); 2129 return phase->C->top();
2133 } 2130 }
2134 return NULL; 2131 return NULL;
2135 } 2132 }