comparison src/share/vm/opto/cfgnode.cpp @ 2445:08eb13460b3a

7004535: Clone loop predicate during loop unswitch Summary: Clone loop predicate for clonned loops Reviewed-by: never
author kvn
date Sat, 02 Apr 2011 10:54:15 -0700
parents f95d63e2154a
children bad7ecd0b6ed
comparison
equal deleted inserted replaced
2444:07acc51c1d2a 2445:08eb13460b3a
1347 //------------------------------split_once------------------------------------- 1347 //------------------------------split_once-------------------------------------
1348 // Helper for split_flow_path 1348 // Helper for split_flow_path
1349 static void split_once(PhaseIterGVN *igvn, Node *phi, Node *val, Node *n, Node *newn) { 1349 static void split_once(PhaseIterGVN *igvn, Node *phi, Node *val, Node *n, Node *newn) {
1350 igvn->hash_delete(n); // Remove from hash before hacking edges 1350 igvn->hash_delete(n); // Remove from hash before hacking edges
1351 1351
1352 Node* predicate_proj = NULL;
1352 uint j = 1; 1353 uint j = 1;
1353 for( uint i = phi->req()-1; i > 0; i-- ) { 1354 for (uint i = phi->req()-1; i > 0; i--) {
1354 if( phi->in(i) == val ) { // Found a path with val? 1355 if (phi->in(i) == val) { // Found a path with val?
1356 if (n->is_Region()) {
1357 Node* proj = PhaseIdealLoop::find_predicate(n->in(i));
1358 if (proj != NULL) {
1359 assert(predicate_proj == NULL, "only one predicate entry expected");
1360 predicate_proj = proj;
1361 }
1362 }
1355 // Add to NEW Region/Phi, no DU info 1363 // Add to NEW Region/Phi, no DU info
1356 newn->set_req( j++, n->in(i) ); 1364 newn->set_req( j++, n->in(i) );
1357 // Remove from OLD Region/Phi 1365 // Remove from OLD Region/Phi
1358 n->del_req(i); 1366 n->del_req(i);
1359 } 1367 }
1360 } 1368 }
1361 1369
1362 // Register the new node but do not transform it. Cannot transform until the 1370 // Register the new node but do not transform it. Cannot transform until the
1363 // entire Region/Phi conglomerate has been hacked as a single huge transform. 1371 // entire Region/Phi conglomerate has been hacked as a single huge transform.
1364 igvn->register_new_node_with_optimizer( newn ); 1372 igvn->register_new_node_with_optimizer( newn );
1373
1374 // Clone loop predicates
1375 if (predicate_proj != NULL) {
1376 newn = igvn->clone_loop_predicates(predicate_proj, newn);
1377 }
1378
1365 // Now I can point to the new node. 1379 // Now I can point to the new node.
1366 n->add_req(newn); 1380 n->add_req(newn);
1367 igvn->_worklist.push(n); 1381 igvn->_worklist.push(n);
1368 } 1382 }
1369 1383