2973 test = phase->idom(test); |
2973 test = phase->idom(test); |
2974 } |
2974 } |
2975 } |
2975 } |
2976 |
2976 |
2977 #ifdef ASSERT |
2977 #ifdef ASSERT |
2978 static CountedLoopNode* locate_pre_from_main(CountedLoopNode *cl) { |
2978 static CountedLoopNode* locate_pre_from_main(CountedLoopNode* main_loop) { |
2979 Node *ctrl = cl->skip_predicates(); |
2979 assert(!main_loop->is_main_no_pre_loop(), "Does not have a pre loop"); |
|
2980 Node* ctrl = main_loop->skip_predicates(); |
2980 assert(ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, ""); |
2981 assert(ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, ""); |
2981 Node *iffm = ctrl->in(0); |
2982 Node* iffm = ctrl->in(0); |
2982 assert(iffm->Opcode() == Op_If, ""); |
2983 assert(iffm->Opcode() == Op_If, ""); |
2983 Node *p_f = iffm->in(0); |
2984 Node* p_f = iffm->in(0); |
2984 assert(p_f->Opcode() == Op_IfFalse, ""); |
2985 assert(p_f->Opcode() == Op_IfFalse, ""); |
2985 CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd(); |
2986 CountedLoopNode* pre_loop = p_f->in(0)->as_CountedLoopEnd()->loopnode(); |
2986 assert(pre_end->loopnode()->is_pre_loop(), ""); |
2987 assert(pre_loop->is_pre_loop(), "No pre loop found"); |
2987 return pre_end->loopnode(); |
2988 return pre_loop; |
2988 } |
2989 } |
2989 #endif |
2990 #endif |
2990 |
2991 |
2991 // Remove the main and post loops and make the pre loop execute all |
2992 // Remove the main and post loops and make the pre loop execute all |
2992 // iterations. Useful when the pre loop is found empty. |
2993 // iterations. Useful when the pre loop is found empty. |
3008 if (!next_head->is_CountedLoop()) { |
3009 if (!next_head->is_CountedLoop()) { |
3009 return; |
3010 return; |
3010 } |
3011 } |
3011 |
3012 |
3012 CountedLoopNode* main_head = next_head->as_CountedLoop(); |
3013 CountedLoopNode* main_head = next_head->as_CountedLoop(); |
3013 if (!main_head->is_main_loop()) { |
3014 if (!main_head->is_main_loop() || main_head->is_main_no_pre_loop()) { |
3014 return; |
3015 return; |
3015 } |
3016 } |
3016 |
3017 |
3017 assert(locate_pre_from_main(main_head) == cl, "bad main loop"); |
3018 assert(locate_pre_from_main(main_head) == cl, "bad main loop"); |
3018 Node* main_iff = main_head->skip_predicates()->in(0); |
3019 Node* main_iff = main_head->skip_predicates()->in(0); |