1322 _stack.push(dead->raw_out(0), PROCESS_INPUTS); 1323 } else { 1324 // Finished disconnecting all input and output edges. 1325 _stack.pop(); 1326 // Remove dead node from iterative worklist 1327 _worklist.remove(dead); 1328 // Constant node that has no out-edges and has only one in-edge from 1329 // root is usually dead. However, sometimes reshaping walk makes 1330 // it reachable by adding use edges. So, we will NOT count Con nodes 1331 // as dead to be conservative about the dead node count at any 1332 // given time. 1333 if (!dead->is_Con()) { 1334 C->record_dead_node(dead->_idx); 1335 } 1336 if (dead->is_macro()) { 1337 C->remove_macro_node(dead); 1338 } 1339 if (dead->is_expensive()) { 1340 C->remove_expensive_node(dead); 1341 } 1342 } 1343 } // while (_stack.is_nonempty()) 1344 } 1345 1346 //------------------------------subsume_node----------------------------------- 1347 // Remove users from node 'old' and add them to node 'nn'. 1348 void PhaseIterGVN::subsume_node( Node *old, Node *nn ) { 1349 assert( old != hash_find(old), "should already been removed" ); 1350 assert( old != C->top(), "cannot subsume top node"); 1351 // Copy debug or profile information to the new version: 1352 C->copy_node_notes_to(nn, old); 1353 // Move users of node 'old' to node 'nn' 1354 for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin; ) { 1355 Node* use = old->last_out(i); // for each use... 1356 // use might need re-hashing (but it won't if it's a new node) 1357 bool is_in_table = _table.hash_delete( use ); 1358 // Update use-def info as well 1359 // We remove all occurrences of old within use->in, 1360 // so as to avoid rehashing any node more than once. 1361 // The hash table probe swamps any outer loop overhead. | 1322 _stack.push(dead->raw_out(0), PROCESS_INPUTS); 1323 } else { 1324 // Finished disconnecting all input and output edges. 1325 _stack.pop(); 1326 // Remove dead node from iterative worklist 1327 _worklist.remove(dead); 1328 // Constant node that has no out-edges and has only one in-edge from 1329 // root is usually dead. However, sometimes reshaping walk makes 1330 // it reachable by adding use edges. So, we will NOT count Con nodes 1331 // as dead to be conservative about the dead node count at any 1332 // given time. 1333 if (!dead->is_Con()) { 1334 C->record_dead_node(dead->_idx); 1335 } 1336 if (dead->is_macro()) { 1337 C->remove_macro_node(dead); 1338 } 1339 if (dead->is_expensive()) { 1340 C->remove_expensive_node(dead); 1341 } 1342 CastIINode* cast = dead->isa_CastII(); 1343 if (cast != NULL && cast->has_range_check()) { 1344 C->remove_range_check_cast(cast); 1345 } 1346 } 1347 } // while (_stack.is_nonempty()) 1348 } 1349 1350 //------------------------------subsume_node----------------------------------- 1351 // Remove users from node 'old' and add them to node 'nn'. 1352 void PhaseIterGVN::subsume_node( Node *old, Node *nn ) { 1353 assert( old != hash_find(old), "should already been removed" ); 1354 assert( old != C->top(), "cannot subsume top node"); 1355 // Copy debug or profile information to the new version: 1356 C->copy_node_notes_to(nn, old); 1357 // Move users of node 'old' to node 'nn' 1358 for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin; ) { 1359 Node* use = old->last_out(i); // for each use... 1360 // use might need re-hashing (but it won't if it's a new node) 1361 bool is_in_table = _table.hash_delete( use ); 1362 // Update use-def info as well 1363 // We remove all occurrences of old within use->in, 1364 // so as to avoid rehashing any node more than once. 1365 // The hash table probe swamps any outer loop overhead. |