Commit b6779d81 by Sebastian Pop Committed by Sebastian Pop

Fix comments in ifconvert.

2010-04-07  Sebastian Pop  <sebastian.pop@amd.com>

	* tree-if-conv.c: Fix indentation and comments.

From-SVN: r158039
parent bdd277f3
2010-04-07 Sebastian Pop <sebastian.pop@amd.com>
* tree-if-conv.c: Fix indentation and comments.
2010-04-06 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/43519
......
......@@ -134,12 +134,12 @@ static bool bb_with_exit_edge_p (struct loop *, basic_block);
/* List of basic blocks in if-conversion-suitable order. */
static basic_block *ifc_bbs;
/* 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). */
/* 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). */
static bool
tree_if_conversion (struct loop *loop, bool for_vectorizer)
......@@ -150,8 +150,8 @@ tree_if_conversion (struct loop *loop, bool for_vectorizer)
ifc_bbs = NULL;
/* if-conversion is not appropriate for all loops. First, check if loop is
if-convertible or not. */
/* 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 (dump_file && (dump_flags & TDF_DETAILS))
......@@ -215,7 +215,7 @@ tree_if_conversion (struct loop *loop, bool for_vectorizer)
return true;
}
/* if-convert stmt T which is part of LOOP.
/* If-convert stmt T which is part of LOOP.
If T is a GIMPLE_ASSIGN then it is converted into conditional modify
expression using COND. For conditional expressions, add condition in the
destination basic block's predicate list and remove conditional
......@@ -253,7 +253,7 @@ tree_if_convert_stmt (struct loop * loop, gimple t, tree cond,
value will be selected by PHI node based on condition. It is possible
that before this transformation, PHI nodes was selecting default
value and now it will use this new value. This is OK because it does
not change validity the program. */
not change the validity of the program. */
break;
case GIMPLE_COND:
......@@ -292,10 +292,10 @@ tree_if_convert_cond_stmt (struct loop *loop, gimple stmt, tree cond,
/* Add new condition into destination's predicate list. */
/* If C is true then TRUE_EDGE is taken. */
/* If C is true, then TRUE_EDGE is taken. */
add_to_dst_predicate_list (loop, true_edge, cond, c, gsi);
/* If 'c' is false then FALSE_EDGE is taken. */
/* If C is false, then FALSE_EDGE is taken. */
c2 = invert_truthvalue_loc (loc, unshare_expr (c));
add_to_dst_predicate_list (loop, false_edge, cond, c2, gsi);
......@@ -313,9 +313,9 @@ tree_if_convert_cond_stmt (struct loop *loop, gimple stmt, tree cond,
/* Return true, iff PHI is if-convertible. PHI is part of loop LOOP
and it belongs to basic block BB.
PHI is not if-convertible
- if it has more than 2 arguments.
- Virtual PHI is immediately used in another PHI node.
- Virtual PHI on BB other than header. */
- if it has more than 2 arguments,
- virtual PHI is immediately used in another PHI node,
- virtual PHI on BB other than header. */
static bool
if_convertible_phi_p (struct loop *loop, basic_block bb, gimple phi)
......@@ -360,8 +360,8 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, gimple phi)
/* Return true, if STMT is if-convertible.
GIMPLE_ASSIGN statement is not if-convertible if,
- It is not movable.
- It could trap.
- it is not movable,
- it could trap,
- LHS is not var decl.
GIMPLE_ASSIGN is part of block BB, which is inside loop LOOP. */
......@@ -420,8 +420,8 @@ if_convertible_gimple_assign_stmt_p (struct loop *loop, basic_block bb,
/* Return true, iff STMT is if-convertible.
Statement is if-convertible if,
- It is if-convertible GIMPLE_ASSGIN
- It is GIMPLE_LABEL or GIMPLE_COND.
- it is if-convertible GIMPLE_ASSGIN,
- it is GIMPLE_LABEL or GIMPLE_COND.
STMT is inside block BB, which is inside loop LOOP. */
static bool
......@@ -459,10 +459,10 @@ if_convertible_stmt_p (struct loop *loop, basic_block bb, gimple stmt)
/* Return true, iff BB is if-convertible.
Note: This routine does _not_ check basic block statements and phis.
Basic block is not if-convertible if,
- Basic block is non-empty and it is after exit block (in BFS order).
- Basic block is after exit block but before latch.
- Basic block edge(s) is not normal.
Basic block is not if-convertible if:
- basic block is non-empty and it is after exit block (in BFS order),
- basic block is after exit block but before latch,
- basic block edge(s) is not normal.
EXIT_BB_SEEN is true if basic block with exit edge is already seen.
BB is inside loop LOOP. */
......@@ -513,15 +513,16 @@ if_convertible_bb_p (struct loop *loop, basic_block bb, basic_block exit_bb)
}
/* Return true, iff 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. See above for
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. See above for
more info.
FOR_VECTORIZER enables vectorizer specific checks. For example, support
for vector conditions, data dependency checks etc.. (Not implemented yet). */
FOR_VECTORIZER enables vectorizer specific checks, for example, support
for vector conditions, data dependency checks, etc.
(Not implemented yet). */
static bool
if_convertible_loop_p (struct loop *loop, bool for_vectorizer ATTRIBUTE_UNUSED)
......@@ -587,21 +588,16 @@ if_convertible_loop_p (struct loop *loop, bool for_vectorizer ATTRIBUTE_UNUSED)
if (!if_convertible_bb_p (loop, bb, exit_bb))
return false;
/* Check statements. */
for (itr = gsi_start_bb (bb); !gsi_end_p (itr); gsi_next (&itr))
if (!if_convertible_stmt_p (loop, bb, gsi_stmt (itr)))
return false;
/* ??? Check data dependency for vectorizer. */
/* What about phi nodes ? */
itr = gsi_start_phis (bb);
/* Clear aux field of incoming edges to a bb with a phi node. */
if (!gsi_end_p (itr))
FOR_EACH_EDGE (e, ei, bb->preds)
e->aux = NULL;
/* Check statements. */
for (; !gsi_end_p (itr); gsi_next (&itr))
if (!if_convertible_phi_p (loop, bb, gsi_stmt (itr)))
return false;
......@@ -610,8 +606,6 @@ if_convertible_loop_p (struct loop *loop, bool for_vectorizer ATTRIBUTE_UNUSED)
exit_bb = bb;
}
/* OK. Did not find any potential issues so go ahead in if-convert
this loop. Now there is no looking back. */
if (dump_file)
fprintf (dump_file,"Applying if-conversion\n");
......@@ -1064,11 +1058,11 @@ pred_blocks_visited_p (basic_block bb, bitmap *visited)
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, BFS order with one
additional constraint. Select block in BFS block, if all
pred are already selected. */
/* 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)
......@@ -1099,6 +1093,7 @@ get_loop_body_in_if_conv_order (const struct loop *loop)
free (blocks);
return NULL;
}
if (!bitmap_bit_p (visited, bb->index))
{
if (pred_blocks_visited_p (bb, &visited)
......@@ -1109,14 +1104,14 @@ get_loop_body_in_if_conv_order (const struct loop *loop)
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment