Mercurial > hg > truffle
comparison src/share/vm/opto/loopTransform.cpp @ 400:cc80376deb0c
6667595: Set probability FAIR for pre-, post- loops and ALWAYS for main loop
Summary: Fix loop's probability. Add optimizations to avoid spilling. Change InlineSmallCode to product flag.
Reviewed-by: never
author | kvn |
---|---|
date | Thu, 02 Oct 2008 08:37:44 -0700 |
parents | 194b8e3a2fc4 |
children | ee8f06bfb27c |
comparison
equal
deleted
inserted
replaced
372:be41fa651400 | 400:cc80376deb0c |
---|---|
677 clone_loop( loop, old_new, dd_main_exit ); | 677 clone_loop( loop, old_new, dd_main_exit ); |
678 assert( old_new[main_end ->_idx]->Opcode() == Op_CountedLoopEnd, "" ); | 678 assert( old_new[main_end ->_idx]->Opcode() == Op_CountedLoopEnd, "" ); |
679 CountedLoopNode *post_head = old_new[main_head->_idx]->as_CountedLoop(); | 679 CountedLoopNode *post_head = old_new[main_head->_idx]->as_CountedLoop(); |
680 post_head->set_post_loop(main_head); | 680 post_head->set_post_loop(main_head); |
681 | 681 |
682 // Reduce the post-loop trip count. | |
683 CountedLoopEndNode* post_end = old_new[main_end ->_idx]->as_CountedLoopEnd(); | |
684 post_end->_prob = PROB_FAIR; | |
685 | |
682 // Build the main-loop normal exit. | 686 // Build the main-loop normal exit. |
683 IfFalseNode *new_main_exit = new (C, 1) IfFalseNode(main_end); | 687 IfFalseNode *new_main_exit = new (C, 1) IfFalseNode(main_end); |
684 _igvn.register_new_node_with_optimizer( new_main_exit ); | 688 _igvn.register_new_node_with_optimizer( new_main_exit ); |
685 set_idom(new_main_exit, main_end, dd_main_exit ); | 689 set_idom(new_main_exit, main_end, dd_main_exit ); |
686 set_loop(new_main_exit, loop->_parent); | 690 set_loop(new_main_exit, loop->_parent); |
746 CountedLoopNode* pre_head = old_new[main_head->_idx]->as_CountedLoop(); | 750 CountedLoopNode* pre_head = old_new[main_head->_idx]->as_CountedLoop(); |
747 CountedLoopEndNode* pre_end = old_new[main_end ->_idx]->as_CountedLoopEnd(); | 751 CountedLoopEndNode* pre_end = old_new[main_end ->_idx]->as_CountedLoopEnd(); |
748 pre_head->set_pre_loop(main_head); | 752 pre_head->set_pre_loop(main_head); |
749 Node *pre_incr = old_new[incr->_idx]; | 753 Node *pre_incr = old_new[incr->_idx]; |
750 | 754 |
755 // Reduce the pre-loop trip count. | |
756 pre_end->_prob = PROB_FAIR; | |
757 | |
751 // Find the pre-loop normal exit. | 758 // Find the pre-loop normal exit. |
752 Node* pre_exit = pre_end->proj_out(false); | 759 Node* pre_exit = pre_end->proj_out(false); |
753 assert( pre_exit->Opcode() == Op_IfFalse, "" ); | 760 assert( pre_exit->Opcode() == Op_IfFalse, "" ); |
754 IfFalseNode *new_pre_exit = new (C, 1) IfFalseNode(pre_end); | 761 IfFalseNode *new_pre_exit = new (C, 1) IfFalseNode(pre_end); |
755 _igvn.register_new_node_with_optimizer( new_pre_exit ); | 762 _igvn.register_new_node_with_optimizer( new_pre_exit ); |
765 Node *min_bol = new (C, 2) BoolNode( min_cmp, b_test ); | 772 Node *min_bol = new (C, 2) BoolNode( min_cmp, b_test ); |
766 register_new_node( min_opaq, new_pre_exit ); | 773 register_new_node( min_opaq, new_pre_exit ); |
767 register_new_node( min_cmp , new_pre_exit ); | 774 register_new_node( min_cmp , new_pre_exit ); |
768 register_new_node( min_bol , new_pre_exit ); | 775 register_new_node( min_bol , new_pre_exit ); |
769 | 776 |
770 // Build the IfNode | 777 // Build the IfNode (assume the main-loop is executed always). |
771 IfNode *min_iff = new (C, 2) IfNode( new_pre_exit, min_bol, PROB_FAIR, COUNT_UNKNOWN ); | 778 IfNode *min_iff = new (C, 2) IfNode( new_pre_exit, min_bol, PROB_ALWAYS, COUNT_UNKNOWN ); |
772 _igvn.register_new_node_with_optimizer( min_iff ); | 779 _igvn.register_new_node_with_optimizer( min_iff ); |
773 set_idom(min_iff, new_pre_exit, dd_main_head); | 780 set_idom(min_iff, new_pre_exit, dd_main_head); |
774 set_loop(min_iff, loop->_parent); | 781 set_loop(min_iff, loop->_parent); |
775 | 782 |
776 // Plug in the false-path, taken if we need to skip main-loop | 783 // Plug in the false-path, taken if we need to skip main-loop |