Commit 19372838 by Richard Guenther Committed by Richard Biener

tree-ssa-pre.c (debug_bitmap_sets_for): New function.

2012-05-03  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-pre.c (debug_bitmap_sets_for): New function.
	(union_contains_value): Remove.
	(vro_valid_in_sets): Likewise.
	(op_valid_in_sets): New function.
	(valid_in_sets): Use op_valid_in_sets.
	(insert_into_preds_of_block): Move dumping ...
	(do_regular_insertion): ... here.
	(do_partial_partial_insertion): ... and here.  Dump that
	we've found a partial partial redundancy.
	(insert): Dump the current insert iteration.

From-SVN: r187092
parent 68d23306
2012-05-03 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (debug_bitmap_sets_for): New function.
(union_contains_value): Remove.
(vro_valid_in_sets): Likewise.
(op_valid_in_sets): New function.
(valid_in_sets): Use op_valid_in_sets.
(insert_into_preds_of_block): Move dumping ...
(do_regular_insertion): ... here.
(do_partial_partial_insertion): ... and here. Dump that
we've found a partial partial redundancy.
(insert): Dump the current insert iteration.
2012-05-03 Jakub Jelinek <jakub@redhat.com> 2012-05-03 Jakub Jelinek <jakub@redhat.com>
PR plugins/53126 PR plugins/53126
......
...@@ -1029,6 +1029,24 @@ debug_bitmap_set (bitmap_set_t set) ...@@ -1029,6 +1029,24 @@ debug_bitmap_set (bitmap_set_t set)
print_bitmap_set (stderr, set, "debug", 0); print_bitmap_set (stderr, set, "debug", 0);
} }
void debug_bitmap_sets_for (basic_block);
DEBUG_FUNCTION void
debug_bitmap_sets_for (basic_block bb)
{
print_bitmap_set (stderr, AVAIL_OUT (bb), "avail_out", bb->index);
if (!in_fre)
{
print_bitmap_set (stderr, EXP_GEN (bb), "exp_gen", bb->index);
print_bitmap_set (stderr, PHI_GEN (bb), "phi_gen", bb->index);
print_bitmap_set (stderr, TMP_GEN (bb), "tmp_gen", bb->index);
print_bitmap_set (stderr, ANTIC_IN (bb), "antic_in", bb->index);
if (do_partial_partial)
print_bitmap_set (stderr, PA_IN (bb), "pa_in", bb->index);
print_bitmap_set (stderr, NEW_SETS (bb), "new_sets", bb->index);
}
}
/* Print out the expressions that have VAL to OUTFILE. */ /* Print out the expressions that have VAL to OUTFILE. */
static void static void
...@@ -2014,57 +2032,19 @@ value_dies_in_block_x (pre_expr expr, basic_block block) ...@@ -2014,57 +2032,19 @@ value_dies_in_block_x (pre_expr expr, basic_block block)
} }
#define union_contains_value(SET1, SET2, VAL) \ /* Determine if OP is valid in SET1 U SET2, which it is when the union
(bitmap_set_contains_value ((SET1), (VAL)) \ contains its value-id. */
|| ((SET2) && bitmap_set_contains_value ((SET2), (VAL))))
/* Determine if vn_reference_op_t VRO is legal in SET1 U SET2.
*/
static bool static bool
vro_valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, op_valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, tree op)
vn_reference_op_t vro)
{ {
if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME) if (op && TREE_CODE (op) == SSA_NAME)
{
struct pre_expr_d temp;
temp.kind = NAME;
temp.id = 0;
PRE_EXPR_NAME (&temp) = vro->op0;
temp.id = lookup_expression_id (&temp);
if (temp.id == 0)
return false;
if (!union_contains_value (set1, set2,
get_expr_value_id (&temp)))
return false;
}
if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME)
{ {
struct pre_expr_d temp; unsigned int value_id = VN_INFO (op)->value_id;
temp.kind = NAME; if (!bitmap_set_contains_value (set1, value_id)
temp.id = 0; || (set2 && !bitmap_set_contains_value (set2, value_id)))
PRE_EXPR_NAME (&temp) = vro->op1;
temp.id = lookup_expression_id (&temp);
if (temp.id == 0)
return false;
if (!union_contains_value (set1, set2,
get_expr_value_id (&temp)))
return false; return false;
} }
if (vro->op2 && TREE_CODE (vro->op2) == SSA_NAME)
{
struct pre_expr_d temp;
temp.kind = NAME;
temp.id = 0;
PRE_EXPR_NAME (&temp) = vro->op2;
temp.id = lookup_expression_id (&temp);
if (temp.id == 0)
return false;
if (!union_contains_value (set1, set2,
get_expr_value_id (&temp)))
return false;
}
return true; return true;
} }
...@@ -2087,21 +2067,8 @@ valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, pre_expr expr, ...@@ -2087,21 +2067,8 @@ valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, pre_expr expr,
unsigned int i; unsigned int i;
vn_nary_op_t nary = PRE_EXPR_NARY (expr); vn_nary_op_t nary = PRE_EXPR_NARY (expr);
for (i = 0; i < nary->length; i++) for (i = 0; i < nary->length; i++)
{ if (!op_valid_in_sets (set1, set2, nary->op[i]))
if (TREE_CODE (nary->op[i]) == SSA_NAME) return false;
{
struct pre_expr_d temp;
temp.kind = NAME;
temp.id = 0;
PRE_EXPR_NAME (&temp) = nary->op[i];
temp.id = lookup_expression_id (&temp);
if (temp.id == 0)
return false;
if (!union_contains_value (set1, set2,
get_expr_value_id (&temp)))
return false;
}
}
/* If the NARY may trap make sure the block does not contain /* If the NARY may trap make sure the block does not contain
a possible exit point. a possible exit point.
??? This is overly conservative if we translate AVAIL_OUT ??? This is overly conservative if we translate AVAIL_OUT
...@@ -2120,7 +2087,9 @@ valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, pre_expr expr, ...@@ -2120,7 +2087,9 @@ valid_in_sets (bitmap_set_t set1, bitmap_set_t set2, pre_expr expr,
FOR_EACH_VEC_ELT (vn_reference_op_s, ref->operands, i, vro) FOR_EACH_VEC_ELT (vn_reference_op_s, ref->operands, i, vro)
{ {
if (!vro_valid_in_sets (set1, set2, vro)) if (!op_valid_in_sets (set1, set2, vro->op0)
|| !op_valid_in_sets (set1, set2, vro->op1)
|| !op_valid_in_sets (set1, set2, vro->op2))
return false; return false;
} }
return true; return true;
...@@ -3330,13 +3299,6 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum, ...@@ -3330,13 +3299,6 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
tree temp; tree temp;
gimple phi; gimple phi;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found partial redundancy for expression ");
print_pre_expr (dump_file, expr);
fprintf (dump_file, " (%04d)\n", val);
}
/* Make sure we aren't creating an induction variable. */ /* Make sure we aren't creating an induction variable. */
if (block->loop_depth > 0 && EDGE_COUNT (block->preds) == 2) if (block->loop_depth > 0 && EDGE_COUNT (block->preds) == 2)
{ {
...@@ -3651,11 +3613,21 @@ do_regular_insertion (basic_block block, basic_block dom) ...@@ -3651,11 +3613,21 @@ do_regular_insertion (basic_block block, basic_block dom)
"optimized for speed edge\n", val); "optimized for speed edge\n", val);
} }
} }
else if (dbg_cnt (treepre_insert) else if (dbg_cnt (treepre_insert))
&& insert_into_preds_of_block (block, {
get_expression_id (expr), if (dump_file && (dump_flags & TDF_DETAILS))
avail)) {
new_stuff = true; fprintf (dump_file, "Found partial redundancy for "
"expression ");
print_pre_expr (dump_file, expr);
fprintf (dump_file, " (%04d)\n",
get_expr_value_id (expr));
}
if (insert_into_preds_of_block (block,
get_expression_id (expr),
avail))
new_stuff = true;
}
} }
/* If all edges produce the same value and that value is /* If all edges produce the same value and that value is
an invariant, then the PHI has the same value on all an invariant, then the PHI has the same value on all
...@@ -3813,6 +3785,14 @@ do_partial_partial_insertion (basic_block block, basic_block dom) ...@@ -3813,6 +3785,14 @@ do_partial_partial_insertion (basic_block block, basic_block dom)
else if (dbg_cnt (treepre_insert)) else if (dbg_cnt (treepre_insert))
{ {
pre_stats.pa_insert++; pre_stats.pa_insert++;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Found partial partial redundancy "
"for expression ");
print_pre_expr (dump_file, expr);
fprintf (dump_file, " (%04d)\n",
get_expr_value_id (expr));
}
if (insert_into_preds_of_block (block, if (insert_into_preds_of_block (block,
get_expression_id (expr), get_expression_id (expr),
avail)) avail))
...@@ -3888,6 +3868,8 @@ insert (void) ...@@ -3888,6 +3868,8 @@ insert (void)
while (new_stuff) while (new_stuff)
{ {
num_iterations++; num_iterations++;
if (dump_file && dump_flags & TDF_DETAILS)
fprintf (dump_file, "Starting insert iteration %d\n", num_iterations);
new_stuff = insert_aux (ENTRY_BLOCK_PTR); new_stuff = insert_aux (ENTRY_BLOCK_PTR);
} }
statistics_histogram_event (cfun, "insert iterations", num_iterations); statistics_histogram_event (cfun, "insert iterations", num_iterations);
......
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