- it has two or more basic blocks,
- it has only one exit,
- loop header is not the exit edge,
- - if its basic blocks and phi nodes are if convertible. See above for
- more info.
- FOR_VECTORIZER enables vectorizer specific checks, for example, support
- for vector conditions, data dependency checks, etc.
- (Not implemented yet). */
-
-static bool
-pred_blocks_visited_p (basic_block bb, bitmap *visited)
-{
- edge e;
- edge_iterator ei;
- FOR_EACH_EDGE (e, ei, bb->preds)
- if (!bitmap_bit_p (*visited, e->src->index))
- return false;
-
- return true;
-}
-
-/* Get body of a LOOP in suitable order for if-conversion. It is
- caller's responsibility to deallocate basic block list.
- If-conversion suitable order is, breadth first sort (BFS) order
- with an additional constraint: select a block only if all its
- predecessors are already selected. */
-
-static basic_block *
-get_loop_body_in_if_conv_order (const struct loop *loop)
-{
- basic_block *blocks, *blocks_in_bfs_order;
- basic_block bb;
- bitmap visited;
- unsigned int index = 0;
- unsigned int visited_count = 0;
-
- gcc_assert (loop->num_nodes);
- gcc_assert (loop->latch != EXIT_BLOCK_PTR);
-
- blocks = XCNEWVEC (basic_block, loop->num_nodes);
- visited = BITMAP_ALLOC (NULL);
-
- blocks_in_bfs_order = get_loop_body_in_bfs_order (loop);
-
- index = 0;
- while (index < loop->num_nodes)
- {
- bb = blocks_in_bfs_order [index];
-
- if (bb->flags & BB_IRREDUCIBLE_LOOP)
- {
- free (blocks_in_bfs_order);
- BITMAP_FREE (visited);
- free (blocks);
- return NULL;
- }
-
- if (!bitmap_bit_p (visited, bb->index))
- {
- if (pred_blocks_visited_p (bb, &visited)
- || bb == loop->header)
- {
- /* This block is now visited. */
- bitmap_set_bit (visited, bb->index);
- blocks[visited_count++] = bb;
- }
- }
-
- index++;
-
- if (index == loop->num_nodes
- && visited_count != loop->num_nodes)
- /* Not done yet. */
- index = 0;
- }
- free (blocks_in_bfs_order);
- BITMAP_FREE (visited);
- return blocks;
-}
-
-/* Return true when LOOP is if-convertible.
- LOOP is if-convertible if:
- - it is innermost,
- - it has two or more basic blocks,
- - it has only one exit,
- - loop header is not the exit edge,
- if its basic blocks and phi nodes are if convertible. */
static bool
/* Main entry point. Apply if-conversion to the LOOP. Return true if
successful otherwise return false. If false is returned then loop
- remains unchanged. FOR_VECTORIZER is a boolean flag. It indicates
- whether if-conversion is used for vectorizer or not. If it is used
- for vectorizer, additional checks are used. (Vectorization checks
- are not yet implemented). */
+ remains unchanged. */
static bool
-tree_if_conversion (struct loop *loop, bool for_vectorizer)
+tree_if_conversion (struct loop *loop)
{
basic_block bb;
gimple_stmt_iterator itr;
/* If-conversion is not appropriate for all loops. First, check if
loop is if-convertible or not. */
- if (!if_convertible_loop_p (loop, for_vectorizer))
+ if (!if_convertible_loop_p (loop))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,"-------------------------\n");