2469 // If succ is loop head, find outer loop. 2470 while (lp != NULL && lp->head() == succ) { 2471 lp = lp->parent(); 2472 } 2473 if (lp == NULL) { 2474 // Infinite loop, it's parent is the root 2475 lp = loop_tree_root(); 2476 } 2477 } 2478 2479 // Check for irreducible loop. 2480 // Successor has already been visited. If the successor's loop head 2481 // has already been post-visited, then this is another entry into the loop. 2482 while (lp->head()->is_post_visited() && lp != loop_tree_root()) { 2483 _has_irreducible_entry = true; 2484 lp->set_irreducible(succ); 2485 if (!succ->is_on_work_list()) { 2486 // Assume irreducible entries need more data flow 2487 add_to_work_list(succ); 2488 } 2489 lp = lp->parent(); 2490 assert(lp != NULL, "nested loop must have parent by now"); 2491 } 2492 2493 // Merge loop tree branch for all successors. 2494 innermost = innermost == NULL ? lp : innermost->sorted_merge(lp); 2495 2496 } // end loop 2497 2498 if (innermost == NULL) { 2499 assert(blk->successors()->length() == 0, "CFG exit"); 2500 blk->set_loop(loop_tree_root()); 2501 } else if (innermost->head() == blk) { 2502 // If loop header, complete the tree pointers 2503 if (blk->loop() != innermost) { 2504 #if ASSERT 2505 assert(blk->loop()->head() == innermost->head(), "same head"); 2506 Loop* dl; 2507 for (dl = innermost; dl != NULL && dl != blk->loop(); dl = dl->parent()); 2508 assert(dl == blk->loop(), "blk->loop() already in innermost list"); 2509 #endif 2510 blk->set_loop(innermost); 2511 } | 2469 // If succ is loop head, find outer loop. 2470 while (lp != NULL && lp->head() == succ) { 2471 lp = lp->parent(); 2472 } 2473 if (lp == NULL) { 2474 // Infinite loop, it's parent is the root 2475 lp = loop_tree_root(); 2476 } 2477 } 2478 2479 // Check for irreducible loop. 2480 // Successor has already been visited. If the successor's loop head 2481 // has already been post-visited, then this is another entry into the loop. 2482 while (lp->head()->is_post_visited() && lp != loop_tree_root()) { 2483 _has_irreducible_entry = true; 2484 lp->set_irreducible(succ); 2485 if (!succ->is_on_work_list()) { 2486 // Assume irreducible entries need more data flow 2487 add_to_work_list(succ); 2488 } 2489 Loop* plp = lp->parent(); 2490 if (plp == NULL) { 2491 // This only happens for some irreducible cases. The parent 2492 // will be updated during a later pass. 2493 break; 2494 } 2495 lp = plp; 2496 } 2497 2498 // Merge loop tree branch for all successors. 2499 innermost = innermost == NULL ? lp : innermost->sorted_merge(lp); 2500 2501 } // end loop 2502 2503 if (innermost == NULL) { 2504 assert(blk->successors()->length() == 0, "CFG exit"); 2505 blk->set_loop(loop_tree_root()); 2506 } else if (innermost->head() == blk) { 2507 // If loop header, complete the tree pointers 2508 if (blk->loop() != innermost) { 2509 #if ASSERT 2510 assert(blk->loop()->head() == innermost->head(), "same head"); 2511 Loop* dl; 2512 for (dl = innermost; dl != NULL && dl != blk->loop(); dl = dl->parent()); 2513 assert(dl == blk->loop(), "blk->loop() already in innermost list"); 2514 #endif 2515 blk->set_loop(innermost); 2516 } |