@@ -1,5 +1,17 @@
2010-10-20 Sebastian Pop <sebastian.pop@amd.com>
+ * passes.c (init_optimization_passes): Do not call pass_if_conversion
+ after pass_flatten_loops.
+ * tree-flow.h (gate_tree_if_conversion): Declared.
+ (tree_if_conversion): Declared.
+ * tree-if-conv.c (tree_if_conversion): Not static anymore.
+ (gate_tree_if_conversion): Same.
+ * tree-loop-flattening.c (flatten_loop): Extra param.
+ Call gate_tree_if_conversion and tree_if_conversion.
+ (tree_loop_flattening): Pass to flatten_loop an extra param.
+
+2010-10-20 Sebastian Pop <sebastian.pop@amd.com>
+
* tree-if-conv.c (if_convertible_loop_p_1): Do not call
compute_data_dependences_for_loop.
(if_convertible_loop_p): Do not free refs and ddrs.
@@ -914,7 +914,6 @@ init_optimization_passes (void)
NEXT_PASS (pass_predcom);
NEXT_PASS (pass_complete_unroll);
NEXT_PASS (pass_flatten_loops);
- NEXT_PASS (pass_if_conversion);
NEXT_PASS (pass_slp_vectorize);
NEXT_PASS (pass_parallelize_loops);
NEXT_PASS (pass_loop_prefetch);
@@ -730,6 +730,10 @@ bool contains_abnormal_ssa_name_p (tree);
bool stmt_dominates_stmt_p (gimple, gimple);
void mark_virtual_ops_for_renaming (gimple);
+/* In tree-if-conv.c */
+bool gate_tree_if_conversion (void);
+bool tree_if_conversion (struct loop *, tree *);
+
/* In tree-ssa-dce.c */
void mark_virtual_phi_result_for_renaming (gimple);
@@ -1599,7 +1599,7 @@ combine_blocks (struct loop *loop, tree *scratch_pad)
/* If-convert LOOP when it is legal. For the moment this pass has no
profitability analysis. Returns true when something changed. */
-static bool
+bool
tree_if_conversion (struct loop *loop, tree *scratch_pad)
{
bool changed = false;
@@ -1662,7 +1662,7 @@ main_tree_if_conversion (void)
/* Returns true when the if-conversion pass is enabled. */
-static bool
+bool
gate_tree_if_conversion (void)
{
return ((flag_tree_vectorize && flag_tree_loop_if_convert != 0)
@@ -497,10 +497,11 @@ add_missing_phi_nodes (loop_p loop)
free (bbs);
}
-/* Removes all the back-edges of LOOP except its own back-edge. */
+/* Removes all the back-edges of LOOP except its own back-edge.
+ SCRATCH_PAD is used in if-conversion. */
static unsigned
-flatten_loop (loop_p loop)
+flatten_loop (loop_p loop, tree *scratch_pad)
{
int i, n = loop->num_nodes;
basic_block *bbs;
@@ -570,6 +571,9 @@ flatten_loop (loop_p loop)
if (!single_pred_p (loop->latch))
loop->latch = split_edge (loop_latch_edge (loop));
+ if (gate_tree_if_conversion ())
+ tree_if_conversion (loop, scratch_pad);
+
return TODO_update_ssa | TODO_verify_ssa;
}
@@ -581,12 +585,13 @@ tree_loop_flattening (void)
unsigned todo = 0;
loop_p loop;
loop_iterator li;
+ tree scratch_pad = NULL_TREE;
if (number_of_loops () <= 1)
return 0;
FOR_EACH_LOOP (li, loop, 0)
- todo |= flatten_loop (loop);
+ todo |= flatten_loop (loop, &scratch_pad);
#ifdef ENABLE_CHECKING
verify_dominators (CDI_DOMINATORS);