diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-12-01 18:03:33 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-12-01 18:03:33 +0100 |
commit | 7e8b1c4bd8462271c21112f735c804a995a2d2f3 (patch) | |
tree | 5c2386eb5272e0528a4f005297028f3f5b9d53ad | |
parent | 0397b9654739300f9a1e8a76c8cc816d3cb83bc7 (diff) | |
download | gcc-7e8b1c4bd8462271c21112f735c804a995a2d2f3.zip gcc-7e8b1c4bd8462271c21112f735c804a995a2d2f3.tar.gz gcc-7e8b1c4bd8462271c21112f735c804a995a2d2f3.tar.bz2 |
re PR tree-optimization/51246 (ICE in replace_ref_with, at tree-predcom.c:1309)
PR tree-optimization/51246
* tree-predcom.c (replace_ref_with): Handle also clobber on the
rhs.
* gcc.c-torture/compile/pr51246.c: New test.
From-SVN: r181884
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr51246.c | 14 | ||||
-rw-r--r-- | gcc/tree-predcom.c | 14 |
4 files changed, 34 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a9c965..f82b8bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2011-12-01 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/51246 + * tree-predcom.c (replace_ref_with): Handle also clobber on the + rhs. + PR rtl-optimization/51014 * loop-unroll.c (apply_opt_in_copies): Ignore label DEBUG_INSNs both from bb and orig_bb. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index acd23f9..7d74e8b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-12-01 Jakub Jelinek <jakub@redhat.com> + PR tree-optimization/51246 + * gcc.c-torture/compile/pr51246.c: New test. + PR rtl-optimization/51014 * g++.dg/opt/pr51014.C: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51246.c b/gcc/testsuite/gcc.c-torture/compile/pr51246.c new file mode 100644 index 0000000..c206d86 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr51246.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/51246 */ + +int a, *b; + +void +test (void) +{ + while (1) + { + int c; + a = c; + b = &c; + } +} diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index c55c89e..751bdeb 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -1306,8 +1306,20 @@ replace_ref_with (gimple stmt, tree new_tree, bool set, bool in_lhs) val = gimple_assign_lhs (stmt); if (TREE_CODE (val) != SSA_NAME) { - gcc_assert (gimple_assign_copy_p (stmt)); val = gimple_assign_rhs1 (stmt); + gcc_assert (gimple_assign_single_p (stmt)); + if (TREE_CLOBBER_P (val)) + { + val = gimple_default_def (cfun, SSA_NAME_VAR (new_tree)); + if (val == NULL_TREE) + { + val = make_ssa_name (SSA_NAME_VAR (new_tree), + gimple_build_nop ()); + set_default_def (SSA_NAME_VAR (new_tree), val); + } + } + else + gcc_assert (gimple_assign_copy_p (stmt)); } } else |