aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2012-11-29 13:53:42 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-11-29 13:53:42 +0000
commite3815735da8f006fa12d990733c55c8d251ab355 (patch)
tree92d4a4969ea735f30246f83718412024e0382063 /gcc
parent88f519b295d8f41ed0b12704ea1701d8df1c78ae (diff)
downloadgcc-e3815735da8f006fa12d990733c55c8d251ab355.zip
gcc-e3815735da8f006fa12d990733c55c8d251ab355.tar.gz
gcc-e3815735da8f006fa12d990733c55c8d251ab355.tar.bz2
tree-ssa-pre.c (get_expr_value_id): Do not add expr to the set of value expressions here.
2012-11-29 Richard Biener <rguenther@suse.de> * tree-ssa-pre.c (get_expr_value_id): Do not add expr to the set of value expressions here. (add_to_exp_gen, make_values_for_phi): Fold into ... (compute_avail): ... here, and avoid useless work. Dump avail sets in processing order. (do_pre): Do not dump avail sets here. From-SVN: r193933
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/tree-ssa-pre.c125
2 files changed, 61 insertions, 73 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index adbf8ed..b45e6e3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2012-11-29 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-pre.c (get_expr_value_id): Do not add expr
+ to the set of value expressions here.
+ (add_to_exp_gen, make_values_for_phi): Fold into ...
+ (compute_avail): ... here, and avoid useless work. Dump
+ avail sets in processing order.
+ (do_pre): Do not dump avail sets here.
+
2012-11-29 Matthew Gretton-Dann <matthew.gretton-dann@linaro.org>
PR target/54974
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 1b20a13..9cf874d 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -612,28 +612,28 @@ bitmap_set_new (void)
static unsigned int
get_expr_value_id (pre_expr expr)
{
+ unsigned int id;
switch (expr->kind)
{
case CONSTANT:
- {
- unsigned int id;
- id = get_constant_value_id (PRE_EXPR_CONSTANT (expr));
- if (id == 0)
- {
- id = get_or_alloc_constant_value_id (PRE_EXPR_CONSTANT (expr));
- add_to_value (id, expr);
- }
- return id;
- }
+ id = get_or_alloc_constant_value_id (PRE_EXPR_CONSTANT (expr));
+ break;
case NAME:
- return VN_INFO (PRE_EXPR_NAME (expr))->value_id;
+ id = VN_INFO (PRE_EXPR_NAME (expr))->value_id;
+ break;
case NARY:
- return PRE_EXPR_NARY (expr)->value_id;
+ id = PRE_EXPR_NARY (expr)->value_id;
+ break;
case REFERENCE:
- return PRE_EXPR_REFERENCE (expr)->value_id;
+ id = PRE_EXPR_REFERENCE (expr)->value_id;
+ break;
default:
gcc_unreachable ();
}
+ /* ??? We cannot assert that expr has a value-id (it can be 0), because
+ we assign value-ids only to expressions that have a result
+ in set_hashtable_value_ids. */
+ return id;
}
/* Return a SCCVN valnum (SSA name or constant) for the PRE value-id VAL. */
@@ -3624,48 +3624,6 @@ insert (void)
}
-/* Add OP to EXP_GEN (block), and possibly to the maximal set. */
-
-static void
-add_to_exp_gen (basic_block block, tree op)
-{
- pre_expr result;
-
- if (TREE_CODE (op) == SSA_NAME && ssa_undefined_value_p (op))
- return;
-
- result = get_or_alloc_expr_for_name (op);
- bitmap_value_insert_into_set (EXP_GEN (block), result);
-}
-
-/* Create value ids for PHI in BLOCK. */
-
-static void
-make_values_for_phi (gimple phi, basic_block block)
-{
- tree result = gimple_phi_result (phi);
- unsigned i;
-
- /* We have no need for virtual phis, as they don't represent
- actual computations. */
- if (virtual_operand_p (result))
- return;
-
- pre_expr e = get_or_alloc_expr_for_name (result);
- add_to_value (get_expr_value_id (e), e);
- bitmap_value_insert_into_set (AVAIL_OUT (block), e);
- bitmap_insert_into_set (PHI_GEN (block), e);
- for (i = 0; i < gimple_phi_num_args (phi); ++i)
- {
- tree arg = gimple_phi_arg_def (phi, i);
- if (TREE_CODE (arg) == SSA_NAME)
- {
- e = get_or_alloc_expr_for_name (arg);
- add_to_value (get_expr_value_id (e), e);
- }
- }
-}
-
/* Compute the AVAIL set for all basic blocks.
This function performs value numbering of the statements in each basic
@@ -3703,6 +3661,14 @@ compute_avail (void)
bitmap_value_insert_into_set (AVAIL_OUT (ENTRY_BLOCK_PTR), e);
}
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_bitmap_set (dump_file, TMP_GEN (ENTRY_BLOCK_PTR),
+ "tmp_gen", ENTRY_BLOCK);
+ print_bitmap_set (dump_file, AVAIL_OUT (ENTRY_BLOCK_PTR),
+ "avail_out", ENTRY_BLOCK);
+ }
+
/* Allocate the worklist. */
worklist = XNEWVEC (basic_block, n_basic_blocks);
@@ -3731,7 +3697,19 @@ compute_avail (void)
/* Generate values for PHI nodes. */
for (gsi = gsi_start_phis (block); !gsi_end_p (gsi); gsi_next (&gsi))
- make_values_for_phi (gsi_stmt (gsi), block);
+ {
+ tree result = gimple_phi_result (gsi_stmt (gsi));
+
+ /* We have no need for virtual phis, as they don't represent
+ actual computations. */
+ if (virtual_operand_p (result))
+ continue;
+
+ pre_expr e = get_or_alloc_expr_for_name (result);
+ add_to_value (get_expr_value_id (e), e);
+ bitmap_value_insert_into_set (AVAIL_OUT (block), e);
+ bitmap_insert_into_set (PHI_GEN (block), e);
+ }
BB_MAY_NOTRETURN (block) = 0;
@@ -3775,7 +3753,12 @@ compute_avail (void)
continue;
FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
- add_to_exp_gen (block, op);
+ {
+ if (ssa_undefined_value_p (op))
+ continue;
+ pre_expr e = get_or_alloc_expr_for_name (op);
+ bitmap_value_insert_into_set (EXP_GEN (block), e);
+ }
switch (gimple_code (stmt))
{
@@ -3911,6 +3894,18 @@ compute_avail (void)
}
}
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_bitmap_set (dump_file, EXP_GEN (block),
+ "exp_gen", block->index);
+ print_bitmap_set (dump_file, PHI_GEN (block),
+ "phi_gen", block->index);
+ print_bitmap_set (dump_file, TMP_GEN (block),
+ "tmp_gen", block->index);
+ print_bitmap_set (dump_file, AVAIL_OUT (block),
+ "avail_out", block->index);
+ }
+
/* Put the dominator children of BLOCK on the worklist of blocks
to compute available sets for. */
for (son = first_dom_son (CDI_DOMINATORS, block);
@@ -4667,22 +4662,6 @@ do_pre (void)
/* Collect and value number expressions computed in each basic block. */
compute_avail ();
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- basic_block bb;
- FOR_ALL_BB (bb)
- {
- print_bitmap_set (dump_file, EXP_GEN (bb),
- "exp_gen", bb->index);
- print_bitmap_set (dump_file, PHI_GEN (bb),
- "phi_gen", bb->index);
- print_bitmap_set (dump_file, TMP_GEN (bb),
- "tmp_gen", bb->index);
- print_bitmap_set (dump_file, AVAIL_OUT (bb),
- "avail_out", bb->index);
- }
- }
-
/* Insert can get quite slow on an incredibly large number of basic
blocks due to some quadratic behavior. Until this behavior is
fixed, don't run it when he have an incredibly large number of