diff options
author | Jeff Law <law@redhat.com> | 2005-05-23 20:54:06 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2005-05-23 20:54:06 -0600 |
commit | 6cedb4acda3240c6a7914834f812aa2e86fa7687 (patch) | |
tree | 83e8422ca8c90a302030075b4f2619a0b55f42df /gcc | |
parent | 0d14c01130fe9b1712c0933a30ed14be8c42c469 (diff) | |
download | gcc-6cedb4acda3240c6a7914834f812aa2e86fa7687.zip gcc-6cedb4acda3240c6a7914834f812aa2e86fa7687.tar.gz gcc-6cedb4acda3240c6a7914834f812aa2e86fa7687.tar.bz2 |
tree-ssa-dom.c (cprop_into_stmt): Do not call recompute_tree_invariant_for_addr_expr here.
* tree-ssa-dom.c (cprop_into_stmt): Do not call
recompute_tree_invariant_for_addr_expr here.
(optimize_stmt): Call it here instead and do so if anything
at all has changed in the statement and the RHS is an ADDR_EXPR.
* tree-ssa-forwprop.c (tidy_after_forward_propagate_addr): If
needed, call recompute_tree_invariant_for_addr_expr.
* tree-ssa-propagate.c (substitute_and_fold): Call
recompute_tree_invariant_for_addr_expr as needed.
* gcc.c-torture/compile/pr21638.c: New test.
* gcc.c-torture/compile/20050520-1.c: New test.
From-SVN: r100092
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20050520-1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr21638.c | 21 | ||||
-rw-r--r-- | gcc/tree-ssa-dom.c | 14 | ||||
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-propagate.c | 8 |
7 files changed, 68 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 783c56d..f553158 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2005-05-23 Jeff Law <law@redhat.com> + + * tree-ssa-dom.c (cprop_into_stmt): Do not call + recompute_tree_invariant_for_addr_expr here. + (optimize_stmt): Call it here instead and do so if anything + at all has changed in the statement and the RHS is an ADDR_EXPR. + * tree-ssa-forwprop.c (tidy_after_forward_propagate_addr): If + needed, call recompute_tree_invariant_for_addr_expr. + * tree-ssa-propagate.c (substitute_and_fold): Call + recompute_tree_invariant_for_addr_expr as needed. + 2005-05-23 Andreas Krebbel <krebbel1@de.ibm.com> * config/s390/s390.c (s390_optimize_prologue): Don't replace an insn diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a29eeea..4efa8b8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-05-23 Jeff Law <law@redhat.com> + + * gcc.c-torture/compile/pr21638.c: New test. + * gcc.c-torture/compile/20050520-1.c: New test. + 2005-05-23 Nick Clifton <nickc@redhat.com> * gcc.c-torture/execute/20020720-1.x: Fix m32r target selector to diff --git a/gcc/testsuite/gcc.c-torture/compile/20050520-1.c b/gcc/testsuite/gcc.c-torture/compile/20050520-1.c new file mode 100644 index 0000000..9e2f6c8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20050520-1.c @@ -0,0 +1,13 @@ +struct s { int x[4]; }; +struct s gs; + +void +bar (void) +{ + struct s *s; + int i; + + s = &gs; + for (i = 0; i < 4; i++) + ((char*) (&s->x[i]))[0] = 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr21638.c b/gcc/testsuite/gcc.c-torture/compile/pr21638.c new file mode 100644 index 0000000..36fd010 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr21638.c @@ -0,0 +1,21 @@ +typedef struct hashhdr { + int bitmaps[32]; +} HASHHDR; + +static void +swap_header_copy(HASHHDR *srcp, HASHHDR *destp) +{ + int i; + for (i = 0; i < 32; i++) + ((char *)&(destp->bitmaps[i]))[0] = ((char *)&(srcp->bitmaps[i]))[1]; +} + +int +flush_meta(HASHHDR *whdrp1) +{ + HASHHDR *whdrp; + HASHHDR whdr; + whdrp = &whdr; + swap_header_copy(whdrp1, whdrp); + return (0); +} diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 692dd70..278d27a 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -2908,7 +2908,6 @@ cprop_into_stmt (tree stmt) bool may_have_exposed_new_symbols = false; use_operand_p op_p; ssa_op_iter iter; - tree rhs; FOR_EACH_SSA_USE_OPERAND (op_p, stmt, iter, SSA_OP_ALL_USES) { @@ -2916,13 +2915,6 @@ cprop_into_stmt (tree stmt) may_have_exposed_new_symbols |= cprop_operand (stmt, op_p); } - if (may_have_exposed_new_symbols) - { - rhs = get_rhs (stmt); - if (rhs && TREE_CODE (rhs) == ADDR_EXPR) - recompute_tree_invarant_for_addr_expr (rhs); - } - return may_have_exposed_new_symbols; } @@ -2971,6 +2963,8 @@ optimize_stmt (struct dom_walk_data *walk_data, basic_block bb, fold its RHS before checking for redundant computations. */ if (ann->modified) { + tree rhs; + /* Try to fold the statement making sure that STMT is kept up to date. */ if (fold_stmt (bsi_stmt_ptr (si))) @@ -2985,6 +2979,10 @@ optimize_stmt (struct dom_walk_data *walk_data, basic_block bb, } } + rhs = get_rhs (stmt); + if (rhs && TREE_CODE (rhs) == ADDR_EXPR) + recompute_tree_invarant_for_addr_expr (rhs); + /* Constant/copy propagation above may change the set of virtual operands associated with this statement. Folding may remove the need for some virtual operands. diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index e4cae68..17da0f1 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -446,12 +446,16 @@ static void tidy_after_forward_propagate_addr (tree stmt) { mark_new_vars_to_rename (stmt); - update_stmt (stmt); /* We may have turned a trapping insn into a non-trapping insn. */ if (maybe_clean_or_replace_eh_stmt (stmt, stmt) && tree_purge_dead_eh_edges (bb_for_stmt (stmt))) cfg_changed = true; + + if (TREE_CODE (TREE_OPERAND (stmt, 1)) == ADDR_EXPR) + recompute_tree_invarant_for_addr_expr (TREE_OPERAND (stmt, 1)); + + update_stmt (stmt); } /* STMT defines LHS which is contains the address of the 0th element diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index ee8b165..865853d 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -1052,8 +1052,10 @@ substitute_and_fold (prop_value_t *prop_value) if (did_replace) { tree old_stmt = stmt; + tree rhs; + fold_stmt (bsi_stmt_ptr (i)); - stmt = bsi_stmt(i); + stmt = bsi_stmt (i); /* If we folded a builtin function, we'll likely need to rename VDEFs. */ @@ -1063,6 +1065,10 @@ substitute_and_fold (prop_value_t *prop_value) remove EH edges. */ if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt)) tree_purge_dead_eh_edges (bb); + + rhs = get_rhs (stmt); + if (TREE_CODE (rhs) == ADDR_EXPR) + recompute_tree_invarant_for_addr_expr (rhs); } if (dump_file && (dump_flags & TDF_DETAILS)) |