diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-06-14 17:19:04 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-06-14 17:19:04 +0200 |
commit | 8ab7d796d82889397ac6b74477be99fc5ee76831 (patch) | |
tree | 2b10d5795fae249a32a7b7b093a1cd54da5bdfdb /gcc | |
parent | 7cec010e49d84d5aad737fc040dc693615f81e78 (diff) | |
download | gcc-8ab7d796d82889397ac6b74477be99fc5ee76831.zip gcc-8ab7d796d82889397ac6b74477be99fc5ee76831.tar.gz gcc-8ab7d796d82889397ac6b74477be99fc5ee76831.tar.bz2 |
re PR tree-optimization/44508 (libgomp.fortran/vla1.f90 ICE on s390)
PR tree-optimization/44508
* tree-ssa-propagate.h (substitute_and_fold): Add DO_DCE
argument.
* tree-ssa-propagate.c (substitute_and_fold): If !DO_DCE,
don't eliminate trivially dead stmts.
* tree-vrp.c (vrp_finalize): Pass false as last argument
to substitute_and_fold.
* tree-ssa-copy.c (fini_copy_prop): Pass true as last argument
to substitute_and_fold.
* tree-ssa-ccp.c (ccp_finalize): Likewise.
* gcc.dg/tree-ssa/pr21086.c: Adjust.
From-SVN: r160749
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr21086.c | 9 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-copy.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-propagate.c | 13 | ||||
-rw-r--r-- | gcc/tree-ssa-propagate.h | 4 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 2 |
8 files changed, 34 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a2778ae..b7c8aec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,16 @@ 2010-06-14 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/44508 + * tree-ssa-propagate.h (substitute_and_fold): Add DO_DCE + argument. + * tree-ssa-propagate.c (substitute_and_fold): If !DO_DCE, + don't eliminate trivially dead stmts. + * tree-vrp.c (vrp_finalize): Pass false as last argument + to substitute_and_fold. + * tree-ssa-copy.c (fini_copy_prop): Pass true as last argument + to substitute_and_fold. + * tree-ssa-ccp.c (ccp_finalize): Likewise. + PR bootstrap/44509 * c-config-lang.in (gtfiles): Add c-family/c-cppbuiltin.c. * c-family/c-cppbuiltin.c: Include gt-c-family-c-cppbuiltin.h. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 013f3bf..4492f0d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2010-06-14 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/44508 + * gcc.dg/tree-ssa/pr21086.c: Adjust. + PR bootstrap/44509 * gcc.dg/pr44509.c: New test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c index 2409608..f924d26 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dce1" } */ int foo (int *p) @@ -16,8 +16,9 @@ foo (int *p) } /* Target with fno-delete-null-pointer-checks should not fold checks */ -/* { dg-final { scan-tree-dump-times "Folding predicate " 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ +/* { dg-final { scan-tree-dump "Folding predicate " "vrp1" { target { ! keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate " 0 "vrp1" { target { keeps_null_pointer_checks } } } } */ -/* { dg-final { scan-tree-dump-not "b_. =" "vrp1" { target { ! avr-*-* } } } } */ -/* { dg-final { scan-tree-dump "b_. =" "vrp1" { target { avr-*-* } } } } */ +/* { dg-final { scan-tree-dump-not "b_. =" "dce1" { target { ! avr-*-* } } } } */ +/* { dg-final { scan-tree-dump "b_. =" "dce1" { target { avr-*-* } } } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */ +/* { dg-final { cleanup-tree-dump "dce1" } } */ diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 44e284f..2b6139b 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -682,7 +682,7 @@ ccp_finalize (void) do_dbg_cnt (); /* Perform substitutions based on the known constant values. */ - something_changed = substitute_and_fold (const_val, ccp_fold_stmt); + something_changed = substitute_and_fold (const_val, ccp_fold_stmt, true); free (const_val); const_val = NULL; diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 7a4c099..87d8968 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -854,7 +854,7 @@ fini_copy_prop (void) duplicate_ssa_name_ptr_info (tmp[i].value, SSA_NAME_PTR_INFO (var)); } - substitute_and_fold (tmp, NULL); + substitute_and_fold (tmp, NULL, true); free (cached_last_copy_of); free (copy_of); diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 879e0db..5f2ecce 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -964,10 +964,13 @@ replace_phi_args_in (gimple phi, prop_value_t *prop_value) If FOLD_FN is non-NULL the function will be invoked on all statements before propagating values for pass specific simplification. + DO_DCE is true if trivially dead stmts can be removed. + Return TRUE when something changed. */ bool -substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) +substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn, + bool do_dce) { basic_block bb; bool something_changed = false; @@ -1012,8 +1015,12 @@ substitute_and_fold (prop_value_t *prop_value, ssa_prop_fold_stmt_fn fold_fn) continue; /* No point propagating into a stmt whose result is not used, - but instead we might be able to remove a trivially dead stmt. */ - if (gimple_get_lhs (stmt) + but instead we might be able to remove a trivially dead stmt. + Don't do this when called from VRP, since the SSA_NAME which + is going to be released could be still referenced in VRP + ranges. */ + if (do_dce + && gimple_get_lhs (stmt) && TREE_CODE (gimple_get_lhs (stmt)) == SSA_NAME && has_zero_uses (gimple_get_lhs (stmt)) && !stmt_could_throw_p (stmt) diff --git a/gcc/tree-ssa-propagate.h b/gcc/tree-ssa-propagate.h index e8f4f03..029d28a 100644 --- a/gcc/tree-ssa-propagate.h +++ b/gcc/tree-ssa-propagate.h @@ -1,6 +1,6 @@ /* Data structures and function declarations for the SSA value propagation engine. - Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc. Contributed by Diego Novillo <dnovillo@redhat.com> This file is part of GCC. @@ -120,6 +120,6 @@ bool valid_gimple_call_p (tree); void move_ssa_defining_stmt_for_defs (gimple, gimple); bool update_call_from_tree (gimple_stmt_iterator *, tree); bool stmt_makes_single_store (gimple); -bool substitute_and_fold (prop_value_t *, ssa_prop_fold_stmt_fn); +bool substitute_and_fold (prop_value_t *, ssa_prop_fold_stmt_fn, bool); #endif /* _TREE_SSA_PROPAGATE_H */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index f0e9ce6..cce2470 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -7343,7 +7343,7 @@ vrp_finalize (void) single_val_range = NULL; } - substitute_and_fold (single_val_range, vrp_fold_stmt); + substitute_and_fold (single_val_range, vrp_fold_stmt, false); if (warn_array_bounds) check_all_array_refs (); |