diff options
author | Richard Guenther <rguenther@suse.de> | 2009-03-28 17:17:57 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-03-28 17:17:57 +0000 |
commit | b005da111c1cfd1b71647eb68eb3fe1bfc35ee64 (patch) | |
tree | defb4df11f0db8f2ada0dda77bfe5190900fb115 /gcc | |
parent | 5d63a35f9f1a1ec0171ae9003fba40ddc60d8f51 (diff) | |
download | gcc-b005da111c1cfd1b71647eb68eb3fe1bfc35ee64.zip gcc-b005da111c1cfd1b71647eb68eb3fe1bfc35ee64.tar.gz gcc-b005da111c1cfd1b71647eb68eb3fe1bfc35ee64.tar.bz2 |
re PR tree-optimization/38723 (default definitions not in avail_out)
2009-03-28 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38723
* tree-ssa-pre.c (compute_avail): Add all default definitions to
the entry block.
* gcc.dg/tree-ssa/ssa-fre-22.c: New testcase.
From-SVN: r145197
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-22.c | 15 | ||||
-rw-r--r-- | gcc/tree-ssa-pre.c | 52 |
4 files changed, 43 insertions, 35 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aff4c85..8dfd7e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-03-28 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/38723 + * tree-ssa-pre.c (compute_avail): Add all default definitions to + the entry block. + 2009-03-28 Jan Hubicka <jh@suse.cz> * tree-ssa-structalias.c (ipa_pta_execute): Fix bogus node->analyzed diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 961d0d6..09a33ef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-03-28 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/38723 + * gcc.dg/tree-ssa/ssa-fre-22.c: New testcase. + 2009-03-28 Paul Thomas <pault@gcc.gnu.org PR fortran/38538 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-22.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-22.c new file mode 100644 index 0000000..ce311b6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-22.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre" } */ + +int i; +int foo (void) +{ + int j; + i = j; + return i; +} + +/* We should eliminate the redundant load of i. */ + +/* { dg-final { scan-tree-dump-not "= i;" "fre" } } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 18c442e..9d06a8a 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -3564,46 +3564,28 @@ compute_avail (void) basic_block block, son; basic_block *worklist; size_t sp = 0; - tree param; + unsigned i; - /* For arguments with default definitions, we pretend they are - defined in the entry block. */ - for (param = DECL_ARGUMENTS (current_function_decl); - param; - param = TREE_CHAIN (param)) + /* We pretend that default definitions are defined in the entry block. + This includes function arguments and the static chain decl. */ + for (i = 1; i < num_ssa_names; ++i) { - if (gimple_default_def (cfun, param) != NULL) - { - tree def = gimple_default_def (cfun, param); - pre_expr e = get_or_alloc_expr_for_name (def); - - add_to_value (get_expr_value_id (e), e); - if (!in_fre) - { - bitmap_insert_into_set (TMP_GEN (ENTRY_BLOCK_PTR), e); - bitmap_value_insert_into_set (maximal_set, e); - } - bitmap_value_insert_into_set (AVAIL_OUT (ENTRY_BLOCK_PTR), e); - } - } + tree name = ssa_name (i); + pre_expr e; + if (!name + || !SSA_NAME_IS_DEFAULT_DEF (name) + || has_zero_uses (name) + || !is_gimple_reg (name)) + continue; - /* Likewise for the static chain decl. */ - if (cfun->static_chain_decl) - { - param = cfun->static_chain_decl; - if (gimple_default_def (cfun, param) != NULL) + e = get_or_alloc_expr_for_name (name); + add_to_value (get_expr_value_id (e), e); + if (!in_fre) { - tree def = gimple_default_def (cfun, param); - pre_expr e = get_or_alloc_expr_for_name (def); - - add_to_value (get_expr_value_id (e), e); - if (!in_fre) - { - bitmap_insert_into_set (TMP_GEN (ENTRY_BLOCK_PTR), e); - bitmap_value_insert_into_set (maximal_set, e); - } - bitmap_value_insert_into_set (AVAIL_OUT (ENTRY_BLOCK_PTR), e); + bitmap_insert_into_set (TMP_GEN (ENTRY_BLOCK_PTR), e); + bitmap_value_insert_into_set (maximal_set, e); } + bitmap_value_insert_into_set (AVAIL_OUT (ENTRY_BLOCK_PTR), e); } /* Allocate the worklist. */ |