comparison src/share/vm/opto/loopnode.cpp @ 372:be41fa651400

Merge
author rasbold
date Tue, 30 Sep 2008 15:53:55 -0700
parents 194b8e3a2fc4
children 3b5ac9e7e6ea
comparison
equal deleted inserted replaced
365:5f44674206d3 372:be41fa651400
1277 // Look for induction variables 1277 // Look for induction variables
1278 1278
1279 // Visit all children, looking for Phis 1279 // Visit all children, looking for Phis
1280 for (DUIterator i = cl->outs(); cl->has_out(i); i++) { 1280 for (DUIterator i = cl->outs(); cl->has_out(i); i++) {
1281 Node *out = cl->out(i); 1281 Node *out = cl->out(i);
1282 if (!out->is_Phi()) continue; // Looking for phis 1282 if (!out->is_Phi() || out == phi) continue; // Looking for other phis
1283 PhiNode* phi2 = out->as_Phi(); 1283 PhiNode* phi2 = out->as_Phi();
1284 Node *incr2 = phi2->in( LoopNode::LoopBackControl ); 1284 Node *incr2 = phi2->in( LoopNode::LoopBackControl );
1285 // Look for induction variables of the form: X += constant 1285 // Look for induction variables of the form: X += constant
1286 if( phi2->region() != _head || 1286 if( phi2->region() != _head ||
1287 incr2->req() != 3 || 1287 incr2->req() != 3 ||
1386 if( _next ) _next ->dump(); 1386 if( _next ) _next ->dump();
1387 } 1387 }
1388 1388
1389 #endif 1389 #endif
1390 1390
1391 static void log_loop_tree(IdealLoopTree* root, IdealLoopTree* loop, CompileLog* log) {
1392 if (loop == root) {
1393 if (loop->_child != NULL) {
1394 log->begin_head("loop_tree");
1395 log->end_head();
1396 if( loop->_child ) log_loop_tree(root, loop->_child, log);
1397 log->tail("loop_tree");
1398 assert(loop->_next == NULL, "what?");
1399 }
1400 } else {
1401 Node* head = loop->_head;
1402 log->begin_head("loop");
1403 log->print(" idx='%d' ", head->_idx);
1404 if (loop->_irreducible) log->print("irreducible='1' ");
1405 if (head->is_Loop()) {
1406 if (head->as_Loop()->is_inner_loop()) log->print("inner_loop='1' ");
1407 if (head->as_Loop()->is_partial_peel_loop()) log->print("partial_peel_loop='1' ");
1408 }
1409 if (head->is_CountedLoop()) {
1410 CountedLoopNode* cl = head->as_CountedLoop();
1411 if (cl->is_pre_loop()) log->print("pre_loop='%d' ", cl->main_idx());
1412 if (cl->is_main_loop()) log->print("main_loop='%d' ", cl->_idx);
1413 if (cl->is_post_loop()) log->print("post_loop='%d' ", cl->main_idx());
1414 }
1415 log->end_head();
1416 if( loop->_child ) log_loop_tree(root, loop->_child, log);
1417 log->tail("loop");
1418 if( loop->_next ) log_loop_tree(root, loop->_next, log);
1419 }
1420 }
1421
1391 //============================================================================= 1422 //=============================================================================
1392 //------------------------------PhaseIdealLoop--------------------------------- 1423 //------------------------------PhaseIdealLoop---------------------------------
1393 // Create a PhaseLoop. Build the ideal Loop tree. Map each Ideal Node to 1424 // Create a PhaseLoop. Build the ideal Loop tree. Map each Ideal Node to
1394 // its corresponding LoopNode. If 'optimize' is true, do some loop cleanups. 1425 // its corresponding LoopNode. If 'optimize' is true, do some loop cleanups.
1395 PhaseIdealLoop::PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me, bool do_split_ifs ) 1426 PhaseIdealLoop::PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me, bool do_split_ifs )
1622 } 1653 }
1623 1654
1624 // Cleanup any modified bits 1655 // Cleanup any modified bits
1625 _igvn.optimize(); 1656 _igvn.optimize();
1626 1657
1627 // Do not repeat loop optimizations if irreducible loops are present 1658 // disable assert until issue with split_flow_path is resolved (6742111)
1628 // by claiming no-progress. 1659 // assert(!_has_irreducible_loops || C->parsed_irreducible_loop() || C->is_osr_compilation(),
1629 if( _has_irreducible_loops ) 1660 // "shouldn't introduce irreducible loops");
1630 C->clear_major_progress(); 1661
1662 if (C->log() != NULL) {
1663 log_loop_tree(_ltree_root, _ltree_root, C->log());
1664 }
1631 } 1665 }
1632 1666
1633 #ifndef PRODUCT 1667 #ifndef PRODUCT
1634 //------------------------------print_statistics------------------------------- 1668 //------------------------------print_statistics-------------------------------
1635 int PhaseIdealLoop::_loop_invokes=0;// Count of PhaseIdealLoop invokes 1669 int PhaseIdealLoop::_loop_invokes=0;// Count of PhaseIdealLoop invokes
2730 // Dump root loop indexed by last element in PO order 2764 // Dump root loop indexed by last element in PO order
2731 dump( _ltree_root, rpo_list.size(), rpo_list ); 2765 dump( _ltree_root, rpo_list.size(), rpo_list );
2732 } 2766 }
2733 2767
2734 void PhaseIdealLoop::dump( IdealLoopTree *loop, uint idx, Node_List &rpo_list ) const { 2768 void PhaseIdealLoop::dump( IdealLoopTree *loop, uint idx, Node_List &rpo_list ) const {
2735 2769 loop->dump_head();
2736 // Indent by loop nesting depth
2737 for( uint x = 0; x < loop->_nest; x++ )
2738 tty->print(" ");
2739 tty->print_cr("---- Loop N%d-N%d ----", loop->_head->_idx,loop->_tail->_idx);
2740 2770
2741 // Now scan for CFG nodes in the same loop 2771 // Now scan for CFG nodes in the same loop
2742 for( uint j=idx; j > 0; j-- ) { 2772 for( uint j=idx; j > 0; j-- ) {
2743 Node *n = rpo_list[j-1]; 2773 Node *n = rpo_list[j-1];
2744 if( !_nodes[n->_idx] ) // Skip dead nodes 2774 if( !_nodes[n->_idx] ) // Skip dead nodes