diff options
author | Richard Guenther <rguenther@suse.de> | 2010-10-20 11:09:54 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-10-20 11:09:54 +0000 |
commit | 742d143c1be9352d388e37bb24ff82c81aca8340 (patch) | |
tree | 787b901537ce872da945a332f8791b8d5726a19e /gcc | |
parent | 0d475ac5b42807b88d77b27bb3762459e6348693 (diff) | |
download | gcc-742d143c1be9352d388e37bb24ff82c81aca8340.zip gcc-742d143c1be9352d388e37bb24ff82c81aca8340.tar.gz gcc-742d143c1be9352d388e37bb24ff82c81aca8340.tar.bz2 |
re PR tree-optimization/45860 (ICE: verify_ssa failed: virtual SSA name for non-VOP decl at -O1)
2010-10-20 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45860
* tree-ssa-phiopt.c (cond_store_replacement): Do not do
conditional store replacement for non-register type stores.
* gcc.dg/torture/pr45860.c: New testcase.
From-SVN: r165718
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr45860.c | 11 | ||||
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 9 |
4 files changed, 26 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a51fad5..4afbaec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-20 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/45860 + * tree-ssa-phiopt.c (cond_store_replacement): Do not do + conditional store replacement for non-register type stores. + 2010-10-20 Eric Botcazou <ebotcazou@adacore.com> * stor-layout.c (skip_simple_constant_arithmetic): New function. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 12d4bef..25fd703 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-20 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/45860 + * gcc.dg/torture/pr45860.c: New testcase. + 2010-10-20 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/discr25.adb: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr45860.c b/gcc/testsuite/gcc.dg/torture/pr45860.c new file mode 100644 index 0000000..4a48bc5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr45860.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ + +void +foo (char *str, int i) +{ + static const char text[] = ""; + str[i] = 0; + if (i & 1) + __builtin_strcpy (str + i, text); +} + diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 482f267..8555bc1 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1204,10 +1204,11 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, || TREE_CODE (TREE_OPERAND (lhs, 0)) != SSA_NAME) return false; - /* RHS is either a single SSA_NAME or a constant. */ + /* RHS is either a single SSA_NAME or a constant of register type. */ code = gimple_assign_rhs_code (assign); if (get_gimple_rhs_class (code) != GIMPLE_SINGLE_RHS - || (code != SSA_NAME && !is_gimple_min_invariant (rhs))) + || (code != SSA_NAME && !is_gimple_min_invariant (rhs)) + || !is_gimple_reg_type (TREE_TYPE (lhs))) return false; /* Prove that we can move the store down. We could also check TREE_THIS_NOTRAP here, but in that case we also could move stores, @@ -1217,8 +1218,8 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, /* Now we've checked the constraints, so do the transformation: 1) Remove the single store. */ - mark_symbols_for_renaming (assign); gsi = gsi_for_stmt (assign); + unlink_stmt_vdef (assign); gsi_remove (&gsi, true); /* 2) Create a temporary where we can store the old content @@ -1237,7 +1238,6 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, name = make_ssa_name (condstoretemp, new_stmt); gimple_assign_set_lhs (new_stmt, name); gimple_set_location (new_stmt, locus); - mark_symbols_for_renaming (new_stmt); gsi_insert_on_edge (e1, new_stmt); /* 4) Create a PHI node at the join block, with one argument @@ -1249,7 +1249,6 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, lhs = unshare_expr (lhs); new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi)); - mark_symbols_for_renaming (new_stmt); /* 5) Insert that PHI node. */ gsi = gsi_after_labels (join_bb); |