equal
deleted
inserted
replaced
1015 |
1015 |
1016 // Find common pieces of the loop being guarded with pre & post loops |
1016 // Find common pieces of the loop being guarded with pre & post loops |
1017 CountedLoopNode *main_head = loop->_head->as_CountedLoop(); |
1017 CountedLoopNode *main_head = loop->_head->as_CountedLoop(); |
1018 assert( main_head->is_normal_loop(), "" ); |
1018 assert( main_head->is_normal_loop(), "" ); |
1019 CountedLoopEndNode *main_end = main_head->loopexit(); |
1019 CountedLoopEndNode *main_end = main_head->loopexit(); |
1020 guarantee(main_end != NULL, "no loop exit node"); |
|
1021 assert( main_end->outcnt() == 2, "1 true, 1 false path only" ); |
1020 assert( main_end->outcnt() == 2, "1 true, 1 false path only" ); |
1022 |
1021 |
1023 Node *pre_header= main_head->in(LoopNode::EntryControl); |
1022 Node *pre_header= main_head->in(LoopNode::EntryControl); |
1024 Node *init = main_head->init_trip(); |
1023 Node *init = main_head->init_trip(); |
1025 Node *incr = main_end ->incr(); |
1024 Node *incr = main_end ->incr(); |
1241 C->set_major_progress(); |
1240 C->set_major_progress(); |
1242 |
1241 |
1243 // Find common pieces of the loop being guarded with pre & post loops |
1242 // Find common pieces of the loop being guarded with pre & post loops |
1244 CountedLoopNode *main_head = loop->_head->as_CountedLoop(); |
1243 CountedLoopNode *main_head = loop->_head->as_CountedLoop(); |
1245 CountedLoopEndNode *main_end = main_head->loopexit(); |
1244 CountedLoopEndNode *main_end = main_head->loopexit(); |
1246 guarantee(main_end != NULL, "no loop exit node"); |
|
1247 // diagnostic to show loop end is not properly formed |
1245 // diagnostic to show loop end is not properly formed |
1248 assert(main_end->outcnt() == 2, "1 true, 1 false path only"); |
1246 assert(main_end->outcnt() == 2, "1 true, 1 false path only"); |
1249 |
1247 |
1250 // mark this loop as processed |
1248 // mark this loop as processed |
1251 main_head->mark_has_atomic_post_loop(); |
1249 main_head->mark_has_atomic_post_loop(); |
1291 C->set_major_progress(); |
1289 C->set_major_progress(); |
1292 |
1290 |
1293 // Find common pieces of the loop being guarded with pre & post loops |
1291 // Find common pieces of the loop being guarded with pre & post loops |
1294 CountedLoopNode *main_head = loop->_head->as_CountedLoop(); |
1292 CountedLoopNode *main_head = loop->_head->as_CountedLoop(); |
1295 CountedLoopEndNode *main_end = main_head->loopexit(); |
1293 CountedLoopEndNode *main_end = main_head->loopexit(); |
1296 guarantee(main_end != NULL, "no loop exit node"); |
|
1297 // diagnostic to show loop end is not properly formed |
1294 // diagnostic to show loop end is not properly formed |
1298 assert(main_end->outcnt() == 2, "1 true, 1 false path only"); |
1295 assert(main_end->outcnt() == 2, "1 true, 1 false path only"); |
1299 |
1296 |
1300 Node *incr = main_end->incr(); |
1297 Node *incr = main_end->incr(); |
1301 Node *limit = main_end->limit(); |
1298 Node *limit = main_end->limit(); |
1425 // Unroll the loop body one step - make each trip do 2 iterations. |
1422 // Unroll the loop body one step - make each trip do 2 iterations. |
1426 void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip ) { |
1423 void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool adjust_min_trip ) { |
1427 assert(LoopUnrollLimit, ""); |
1424 assert(LoopUnrollLimit, ""); |
1428 CountedLoopNode *loop_head = loop->_head->as_CountedLoop(); |
1425 CountedLoopNode *loop_head = loop->_head->as_CountedLoop(); |
1429 CountedLoopEndNode *loop_end = loop_head->loopexit(); |
1426 CountedLoopEndNode *loop_end = loop_head->loopexit(); |
1430 assert(loop_end, ""); |
|
1431 #ifndef PRODUCT |
1427 #ifndef PRODUCT |
1432 if (PrintOpto && VerifyLoopOptimizations) { |
1428 if (PrintOpto && VerifyLoopOptimizations) { |
1433 tty->print("Unrolling "); |
1429 tty->print("Unrolling "); |
1434 loop->dump_head(); |
1430 loop->dump_head(); |
1435 } else if (TraceLoopOpts) { |
1431 } else if (TraceLoopOpts) { |
2970 } else if (!_igvn.type(n->in(MemNode::Address))->isa_aryptr()) { |
2966 } else if (!_igvn.type(n->in(MemNode::Address))->isa_aryptr()) { |
2971 msg = "not array address"; |
2967 msg = "not array address"; |
2972 } |
2968 } |
2973 store = n; |
2969 store = n; |
2974 store_value = value; |
2970 store_value = value; |
2975 } else if (n->is_If() && n != head->loopexit()) { |
2971 } else if (n->is_If() && n != head->loopexit_or_null()) { |
2976 msg = "extra control flow"; |
2972 msg = "extra control flow"; |
2977 msg_node = n; |
2973 msg_node = n; |
2978 } |
2974 } |
2979 } |
2975 } |
2980 |
2976 |
3112 // store related values are ok |
3108 // store related values are ok |
3113 ok.set(store->_idx); |
3109 ok.set(store->_idx); |
3114 ok.set(store->in(MemNode::Memory)->_idx); |
3110 ok.set(store->in(MemNode::Memory)->_idx); |
3115 |
3111 |
3116 CountedLoopEndNode* loop_exit = head->loopexit(); |
3112 CountedLoopEndNode* loop_exit = head->loopexit(); |
3117 guarantee(loop_exit != NULL, "no loop exit node"); |
|
3118 |
3113 |
3119 // Loop structure is ok |
3114 // Loop structure is ok |
3120 ok.set(head->_idx); |
3115 ok.set(head->_idx); |
3121 ok.set(loop_exit->_idx); |
3116 ok.set(loop_exit->_idx); |
3122 ok.set(head->phi()->_idx); |
3117 ok.set(head->phi()->_idx); |